Documentation ¶
Overview ¶
Package metadata allows to set/get additional context details from/on HTTP requests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
Handler allows keeping HTTP headers or other request details as metadata in the context used when processing incoming requests. This allows other extensions and resolvers to have access to required information.
Upstream elements can retrieve available metadata with:
md, ok := FromContext(ctx)
Types ¶
type MD ¶
MD provides a simple mechanism to propagate custom values through the context instance used while processing operations. Based on the gRPC implementation.
type Options ¶
type Options struct { // The headers must be specified in its lowercase (non-canonical) form. // If no specific headers are provided, all headers in the request are // registered as metadata by default. Headers []string `json:"headers" yaml:"headers" mapstructure:"headers"` // Provides complete flexibility to adjust the metadata produced for a // received request. Hook func(md *MD, r http.Request) `json:"-" yaml:"-" mapstructure:"-"` }
Options available to adjust the behavior of the metadata middleware.
Click to show internal directories.
Click to hide internal directories.