Documentation ¶
Overview ¶
Package common is used to hold things that multiple packags within the mediocre-api toolkit will need to use or reference
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPError ¶
func HTTPError(w http.ResponseWriter, r *http.Request, err error)
HTTPError will attempt to cast the given error to an ExpectedErr. If it's able to it will write that error and its response code back to the http.ResponseWriter. Otherwise it will log the error and send back a 500 unknown server-side error. If err is nil it will do nothing.
Types ¶
type ExpectedErr ¶
ExpectedErr is an implementation of the error interface which will be used to indicate that the error being returned is an expected one and can sent back to the client
func ExpectedErrf ¶
func ExpectedErrf(code int, s string, args ...interface{}) ExpectedErr
ExpectedErrf returns an ExpectedErr with a formatted message
Directories ¶
Path | Synopsis |
---|---|
Package apihelper contains some methods which make working with the http package a bit nicer
|
Package apihelper contains some methods which make working with the http package a bit nicer |
Package commontest holds methods which are helpful when writing tests within mediocre-api
|
Package commontest holds methods which are helpful when writing tests within mediocre-api |
Package resphelper provides a number of methods for working with radix.v2 Resp structs
|
Package resphelper provides a number of methods for working with radix.v2 Resp structs |
Click to show internal directories.
Click to hide internal directories.