Documentation ¶
Index ¶
Constants ¶
const Key key = 0
Key is the key that holds the unique request ID in a request context.
Variables ¶
var UUID = InheritOrGenerate("X-Request-Id", func(r *http.Request) string { return uuid.New().String() })
UUID is a middleware which will inherit a request ID from the X-Request-ID header from an incoming HTTP request or otherwise generate a new UUID and store it in the request's context.
Functions ¶
func InheritOrGenerate ¶
InheritOrGenerate is a middleware which stores a unique request ID into the context of each incoming HTTP request. Use headerName to specify the HTTP header from which an already existing request ID should be inherited (e.g. X-Correlation-Id or X-Request-Id). If no request ID has been sent with the incoming HTTP request then a new request ID will be generated by calling the RequestIDFactoryFunc.
Types ¶
type FactoryFunc ¶
FactoryFunc generates a unique request ID based on an incoming HTTP request.