httpclient

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(options ...ClientOption) *http.Client

NewClient returns a new Client.

func NewClientWithTransport

func NewClientWithTransport(transport http.RoundTripper) *http.Client

NewClientWithTransport returns a new Client with the given transport. This is a separate constructor so that it's clear it cannot be used in combination with other ClientOptions.

Types

type ClientInterceptorFunc added in v1.8.0

type ClientInterceptorFunc func(http.RoundTripper) http.RoundTripper

ClientInterceptorFunc is a function that wraps a RoundTripper with any interceptors

type ClientOption

type ClientOption func(*clientOptions)

ClientOption is an option for a new Client.

func WithH2C added in v1.8.0

func WithH2C() ClientOption

WithH2C returns a new ClientOption that allows dialing h2c (cleartext) servers.

func WithInterceptorFunc added in v1.8.0

func WithInterceptorFunc(interceptorFunc ClientInterceptorFunc) ClientOption

WithInterceptorFunc returns a new ClientOption to use a given interceptor.

func WithProxy added in v1.8.0

func WithProxy(proxyFunc Proxy) ClientOption

WithProxy returns a new ClientOption to use a proxy.

The default is to use http.ProxyFromEnvironment

func WithTLSConfig added in v1.8.0

func WithTLSConfig(tlsConfig *tls.Config) ClientOption

WithTLSConfig returns a new ClientOption to use the tls.Config.

The default is to use no TLS.

type Proxy added in v1.7.0

type Proxy func(req *http.Request) (*url.URL, error)

Proxy specifies a function to return a proxy for a given Request. If the function returns a non-nil error, the request is aborted with the provided error.

Jump to

Keyboard shortcuts

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