Documentation ¶
Index ¶
- Variables
- func Error(r *http.Request, w http.ResponseWriter, err Err)
- func Headless(manager *sessions.Manager) func(http.Handler) http.Handler
- func IDParam(r *http.Request, name string) uint
- func Load(m *sessions.Manager, r *http.Request, v interface{})
- func LoadBearer(m *sessions.Manager, r *http.Request, v interface{})
- func LoadCookie(m *sessions.Manager, r *http.Request, v interface{})
- func LoadHeadless(m *sessions.Manager, r *http.Request, v interface{})
- func QueryParam(r *http.Request, v interface{})
- func ReadJSON(r *http.Request, v interface{})
- func Recoverer(env string) func(http.Handler) http.Handler
- func Success(r *http.Request, w http.ResponseWriter, v interface{})
- type Err
Constants ¶
This section is empty.
Variables ¶
var STACK_SIZE = 12 * 1024
STACK_SIZE is the number of bytes to print to stderr when recovering from a panic
var StringParam = requests.StringParam
StringParam basically just ensures the param name is correct. You might not need this method unless you're too lazy to do real tests. Panics if there's no param with the name.
Functions ¶
func Error ¶
func Error(r *http.Request, w http.ResponseWriter, err Err)
Error sends a JSend error message. It logs the response if a zerolog.Logger is attached to the request.
func IDParam ¶
IDParam extracts a uint URL parameter from the given request. panics with a 400 if the param is not a strin, otherwise it panics with a basic error.
func LoadCookie ¶ added in v0.19.0
func QueryParam ¶ added in v0.17.0
QueryParams converts the query values of the request into a struct using the "json" tag to map the keys. It supports transformations using modl and validation provided by ozzo. It panics with a 400 if the value fails ozzo validation or any other error
func ReadJSON ¶
ReadJSON parses the body of an http request into the value pointed by v. It panics with a 415 error if the content type is not JSON, a 400 if the value fails ozzo validation or any other error(JSON decode error for instance)