Documentation ¶
Overview ¶
Package wrappers contains httprouter.Handle wrappers that are used in the API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrHandlerTimeout = errors.New("http: Handler timeout")
ErrHandlerTimeout is returned on ResponseWriter Write calls in handlers which have timed out.
Functions ¶
func Log ¶
func Log(fn httprouter.Handle) httprouter.Handle
Log wraps a http.HandlerFunc and logs the API call
func TimeOut ¶
func TimeOut(d time.Duration, fn httprouter.Handle) httprouter.Handle
TimeOut wraps a http.HandlerFunc and ensure that a response is given under the specified duration.
If the handler takes longer than the time limit, the wrapper responds with a Service Unavailable error, an error message and the handler response which may come later is ignored.
After a timeout, any write the handler to its ResponseWriter will return ErrHandlerTimeout.
If the duration is 0, the wrapper does nothing.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.