Documentation
¶
Index ¶
- func Client() *http.Client
- func CopyDeadline(ctx context.Context, h http.Header) (context.Context, context.CancelFunc)
- func Extract(ctx context.Context, h http.Header) context.Context
- func ExtractWithDeadline(ctx context.Context, h http.Header) (context.Context, context.CancelFunc)
- func WrapClient(c *http.Client) *http.Client
- func WrapHandler(h http.Handler) http.Handler
- func WrapHandlerFunc(h http.HandlerFunc) http.HandlerFunc
- type ContextRoundTripper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyDeadline ¶
CopyDeadline searches for the deadline in the headers and returns an updated context with a cancellation function. If the headers do not include the deadline value, the context is returned unchanged and the cancellation function will be nil.
func Extract ¶
Extract extracts the values from the headers (or trailers) and returns a new context with the values found. This method will never set a deadline on the context.
func ExtractWithDeadline ¶
ExtractWithDeadline works as Extract, but will set a deadline if one is found in the headers. In that case (only), the cancellation function will be nil.
func WrapClient ¶
WrapClient wraps a standard http.Client.
func WrapHandler ¶
WrapHandler wraps an http.Handler, adding configured values to the incoming context. Sets a deadline (and handles its cancellation) when one is found. Does not process outgoing response headers.
func WrapHandlerFunc ¶
func WrapHandlerFunc(h http.HandlerFunc) http.HandlerFunc
WrapHandlerFunc wraps an http.HandlerFunc, adding configured values to the incoming context. Sets a deadline (and handles its cancellation) when one is found. Does not process outgoing response headers.
Types ¶
type ContextRoundTripper ¶
type ContextRoundTripper struct {
// contains filtered or unexported fields
}
A ContextRoundTripper propagates the configured context values in an outgoing HTTP request. It does not handle returned response headers.