Documentation ¶
Index ¶
- Variables
- func BaseURL(ctx context.Context) *url.URL
- func ClientContext(parent context.Context, client *http.Client) context.Context
- func ClientFromContext(ctx context.Context) *http.Client
- func Host(ctx context.Context) string
- func RequestContext(parent context.Context, w http.ResponseWriter, r *http.Request) (context.Context, func())
- func RequestFromContext(ctx context.Context) *http.Request
Constants ¶
This section is empty.
Variables ¶
var DefaultHost = ""
Functions ¶
func BaseURL ¶
BaseURL returns the "base" url for this request, defined as a url containing the Host and Scheme portions of the request uri.
func ClientContext ¶
ClientContext binds the provided client to a new context derived from the provided parent. Use httpx.ClientFromContext to retrieve the client at some later point.
func ClientFromContext ¶
ClientFromContext retrieves a http.Client that has been bound to this context previously by a call to httpx.ClientContext, defaulting to a default Client if none has been bound
func RequestContext ¶
func RequestContext(parent context.Context, w http.ResponseWriter, r *http.Request) (context.Context, func())
RequestContext returns a context representing the provided http action. It also integrates `http.CloseNotifier` with `context.Context`, returning a context that will be canceled when the http connection underlying `w` is closed.
Types ¶
This section is empty.