Documentation ¶
Overview ¶
Package requestid provides HTTP request ID functionality
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext returns the request ID from the context if it exists and is not the empty value.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new request ID [handler]. It takes a trace header, which is used keep the legacy behavior intact, which relies on the X-Smallstep-Id header instead of X-Request-Id.
func (*Handler) Middleware ¶
Middleware wraps an http.Handler with request ID extraction from the X-Reqeust-Id header by default, or from the X-Smallstep-Id header if not set. If both are not set, a new request ID is generated. In all cases, the request ID is added to the request context, and set to be reflected in the response.
Click to show internal directories.
Click to hide internal directories.