http

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

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

func FromContext(ctx context.Context) string

FromContext extracts the environment name from the context.

func PropagateEnvironment

func PropagateEnvironment(next http.Handler) http.Handler

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL