httputils

package
v0.0.0-...-ecb1187 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *logrus.Logger

Functions

func ReadJSON

func ReadJSON(r *http.Request, obj interface{}) error

func Response302

func Response302(w http.ResponseWriter, url string)

func Response404

func Response404(w http.ResponseWriter)

func ResponseWithError

func ResponseWithError(w http.ResponseWriter, err error)

func ResponseWithJSON

func ResponseWithJSON(w http.ResponseWriter, code int, msg string, payload interface{})

Types

type Error

type Error interface {
	error
	Status() int
}

type HttpStatusError

type HttpStatusError struct {
	Code int
	Err  error
}

func (*HttpStatusError) Error

func (e *HttpStatusError) Error() string

func (*HttpStatusError) Status

func (e *HttpStatusError) Status() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL