Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchRoutePathTemplate ¶
FetchRoutePathTemplate extracts the path template from a given request, or emptry string if none could be found.
func StatusRecorderMiddleware ¶ added in v0.13.0
StatusRecorderMiddleware wraps the http.ResponseWriter with StatusRecorder so that downstream middlewares can utilize the outcome status code after the response completes. This middleware should be attached as early as possible.
Types ¶
type StatusRecorder ¶
type StatusRecorder struct { http.ResponseWriter StatusCode int }
StatusRecorder wraps the http ResponseWriter, allowing additional instrumentation and metrics capture before the response is returned to the client.
func (*StatusRecorder) WriteHeader ¶
func (sr *StatusRecorder) WriteHeader(code int)
WriteHeader implements the http ResponseWriter WriteHeader interface. This function acts as a middleware which captures the StatusCode on the StatusRecorder and then delegates the actual work of writing the header to the underlying http ResponseWriter.