httpclient

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: Apache-2.0 Imports: 8 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 WithObservability added in v1.8.0

func WithObservability(tags ...tag.Mutator) ClientOption

WithObservability returns a new ClientOption to use OpenCensus tracing and metrics.

The default is to use no observability.

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