httpx

package
v0.0.0-...-3597e88 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHost = ""

Functions

func BaseURL

func BaseURL(ctx context.Context) *url.URL

BaseURL returns the "base" url for this request, defined as a url containing the Host and Scheme portions of the request uri.

func ClientContext

func ClientContext(parent context.Context, client *http.Client) context.Context

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

func ClientFromContext(ctx context.Context) *http.Client

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 Host

func Host(ctx context.Context) string

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.

func RequestFromContext

func RequestFromContext(ctx context.Context) *http.Request

Types

This section is empty.

Jump to

Keyboard shortcuts

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