Documentation ¶
Index ¶
- func DissectFormRequest(r *http.Request) dissectors.DissectedRequest
- func DissectJSONRequest(r *http.Request) dissectors.DissectedRequest
- func DissectNoBodyRequest(r *http.Request) dissectors.DissectedRequest
- func HandleError(w http.ResponseWriter, r *http.Request, rootErr error)
- func JSONHandler(handler func(*http.Request) (interface{}, error)) http.HandlerFunc
- func MediaHandler(handler func(*http.Request) (io.Reader, error)) http.Handler
- func Route(r chi.Router, method string, path string, handler http.Handler)
- type StackTraceEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DissectFormRequest ¶
func DissectFormRequest(r *http.Request) dissectors.DissectedRequest
DissectFormRequest is a gorilla.mux focused rewrap of dissectors.DissectFormRequest
func DissectJSONRequest ¶
func DissectJSONRequest(r *http.Request) dissectors.DissectedRequest
DissectJSONRequest is a gorilla.mux focused rewrap of dissectors.DissectJSONRequest
func DissectNoBodyRequest ¶
func DissectNoBodyRequest(r *http.Request) dissectors.DissectedRequest
DissectNoBodyRequest is a gorilla.mux focused rewrap of dissectors.DissectPlainRequest
func HandleError ¶
func HandleError(w http.ResponseWriter, r *http.Request, rootErr error)
HandleError will set the proper status code for the given error and return a json response body with a public reason listed
Note: In general, users should prefer to use JSONHandler or MediaHandler. This function should only be used in instances where those handlers cannot be used (e.g. because of a redirect)
func JSONHandler ¶
func JSONHandler(handler func(*http.Request) (interface{}, error)) http.HandlerFunc
JSONHandler provides a generic handler for any request that prefers JSON responses. In all success scenarios, and most error scenarios, json is returned. The exception here is when this project cannot decode/Marshal a JSON message, in which case a plain 500 error with no content is returned.
func MediaHandler ¶
MediaHandler provides a generic handler for any content that _prefers_ a return value as raw data. In success situtations, the response will be returned as just a stream of bytes. In failure cases the output will instead be json, which conforms to the remainder of the project
Types ¶
type StackTraceEntry ¶
StackTraceEntry is a small structure for holding relevent data pertaining to a single line in a stacktrace.