Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRequestID ¶
GetRequestID gets the request id from a request's context. If none was set (i.e. the RequestID middleware wasn't run), then an empty string is returned.
func Recoverer ¶
Recoverer recovers from panics, and reports an internal server error. The panic will be logged, along with a stack trace.
func RequestID ¶
RequestID manages request IDs, similarly to Heroku's method. If the client sets X-Request-ID, then it is used. If no request ID is provided, or the provided request ID is not between 20 and 200 characters (inclusive), then a ULID is generated and used.
The request ID is also written to the ResponseWriter, and if a zap logger is in the request context, added with the provided field key.
NOTE: The http.Handler interface requires that handlers not modify the request. In order to get the "real" request ID, use the GetRequestID function.
Types ¶
This section is empty.