Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultHeaderKey = sdk.DefaultHeaderKey
DefaultHeaderKey is used by the middleware to extract the X-Diverge-Env header and inject it into the request context.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext extracts the environment name from the context.
func PropagateEnvironment ¶
PropagateEnvironment returns middleware that propagates the x-diverge-env header from incoming requests to outgoing requests via the request context.
Example:
// Incoming handler:
mux.Use(divergehttp.PropagateEnvironment)
// Outgoing client:
client := &http.Client{
Transport: divergehttp.RoundTripper(http.DefaultTransport),
}
func RoundTripper ¶
func RoundTripper(base http.RoundTripper) http.RoundTripper
RoundTripper wraps an http.RoundTripper to inject x-diverge-env from context into outgoing HTTP requests.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.