executors

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package executors provides default httpx.ExecFn based on Go standard library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithClient

func WithClient(opts ...func(*http.Client)) httpx.ExecFn

WithClient returns an ExecFn that wraps an http.Client. Use opts to customise the http.Client.

func WithCookieJar

func WithCookieJar(jar http.CookieJar) func(*http.Client)

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

func WithDefaultClient() httpx.ExecFn

WithDefaultClient wraps the http.DefaultClient into an ExecFn and returns it

func WithHandler

func WithHandler(handler http.Handler) httpx.ExecFn

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

func WithNoRedirect() func(*http.Client)

WithNoRedirect disables redirect on http.Client.

func WithTimeout

func WithTimeout(d time.Duration) func(*http.Client)

WithTimeout configures a timeout on the given http.Client

func WithTransport

func WithTransport(t *http.Transport) func(*http.Client)

WithTransport sets the given transport to use with the client. Use this to set custom transport that, for example, does TLS client authentication and more.

Types

This section is empty.

Jump to

Keyboard shortcuts

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