Documentation ¶
Overview ¶
Package executors provides default httpx.ExecFn based on Go standard library.
Index ¶
- func WithClient(opts ...func(*http.Client)) httpx.ExecFn
- func WithCookieJar(jar http.CookieJar) func(*http.Client)
- func WithDefaultClient() httpx.ExecFn
- func WithHandler(handler http.Handler) httpx.ExecFn
- func WithHandlerFn(fn http.HandlerFunc) httpx.ExecFn
- func WithNoRedirect() func(*http.Client)
- func WithTimeout(d time.Duration) func(*http.Client)
- func WithTransport(t *http.Transport) func(*http.Client)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithClient ¶
WithClient returns an ExecFn that wraps an http.Client. Use opts to customise the http.Client.
func WithCookieJar ¶
WithCookies set the given cookie jar on the http.Client. The jar is consulted for cookies on requests made by the client and store cookies from responses. If you don't need that, you can also set cookies on individual request.
func WithDefaultClient ¶
WithDefaultClient wraps the http.DefaultClient into an ExecFn and returns it
func WithHandler ¶
WithHandler wraps the given http.Handler and returns an ExecFn that invokes the handler on request and return the response. This ExecFn doesn't need to make network round-trip and can be used to implement unit tests for http endpoints in your application.
func WithHandlerFn ¶
func WithHandlerFn(fn http.HandlerFunc) httpx.ExecFn
WithHandlerFn wraps the given http.HandlerFunc and returns an ExecFn. See WithHandler(...) for more details.
func WithNoRedirect ¶
WithNoRedirect disables redirect on http.Client.
func WithTimeout ¶
WithTimeout configures a timeout on the given http.Client
Types ¶
This section is empty.