package
0.0.0-20230221173606-60c88552c1c9
Repository: https://github.com/intercom/gocore.git
Documentation: pkg.go.dev
# Functions
EmptyResponse returns a Response object without a body.
Get the Logger stored in request context, or nil.
Get the MetricsRecorder stored in request context, or nil.
Get the Monitor stored in request context, or nil.
Get the RequestID stored in request context, or empty.
JSONErrorResponse returns a Response object formatted to display given error as JSON.
JSONResponse builds a Response with the body formatted as JSON.
LogRequest logs the start and end of a request.
No description provided by the author
NewMiddlewareMuxWithDefaults sets up a basic middleware mux with default middleware of logger, metrics, monitoring, request id and status wrapping.
Recoverer recovers from panic and prints a log line to the request's logger, if available.
No description provided by the author
WithLogger adds a "logger" key to the request context.
WithMetrics adds a "metrics" key to the request context.
WithMonitor adds a "monitor" key to the request context.
WithRequestID adds a "requestID" key to the request context.
WithStatusWrappingResponseWriter wraps the default response writer to allow tracking of previously written status.
# Variables
ErrAuthentication returned when Authentication has failed.
# Structs
MiddlewareMux wraps the default router with a couple of methods to allow easier middleware usage.
A Response contains information to be written.
StatusWrappingResponseWriter wraps a http.ResponseWriter, overriding WriteHeader to keep a record of the Status set.