Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NotFound = &HTTPError{Status: 404, Code: "not_found", Message: "Not Found"} InternalError = &HTTPError{Status: 500, Code: "internal_error", Message: "Internal Server Error"} MethodNotAllowed = &HTTPError{Status: 405, Code: "method_not_allowed", Message: "Method Not Allowed"} InvalidRequest = &HTTPError{Status: 400, Code: "invalid_request", Message: "Invalid Request"} )
Functions ¶
func Decode ¶
Decode decodes the request body as HuJSON. If an error occurs it might wrap the error as an HTTPError.
func DecodeStrict ¶
StrictDecode works like Decode but does not allow unknown fields.
func WriteError ¶
func WriteError(w http.ResponseWriter, err error) bool
WriteError encodes err to w, setting the approriate headers, if the underlying type of err is an HTTPError and returns true; otherwise it does nothing and returns false.
Types ¶
Click to show internal directories.
Click to hide internal directories.