httpclient

package
v0.0.0-...-f075a53 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func CreateDefaultClient

func CreateDefaultClient(certPool *x509.CertPool) *http.Client

func CreateDefaultClientInsecureSkipVerify

func CreateDefaultClientInsecureSkipVerify() *http.Client

func CreateExternalDefaultClient

func CreateExternalDefaultClient(certPool *x509.CertPool) *http.Client

func CreateKeepAliveDefaultClient

func CreateKeepAliveDefaultClient(certPool *x509.CertPool) *http.Client

func MakeReplayable

func MakeReplayable(r *http.Request) (io.ReadCloser, error)

func NewMutualTLSClient

func NewMutualTLSClient(identity tls.Certificate, caCertPool *x509.CertPool, serverName string) *http.Client

func WithClientSessionCache

func WithClientSessionCache(capacity int) tlsconfig.TLSOption

func WithInsecureSkipVerify

func WithInsecureSkipVerify(insecureSkipVerify bool) tlsconfig.TLSOption

Types

type Client

type Client interface {
	Do(*http.Request) (*http.Response, error)
}

func NewNetworkSafeRetryClient

func NewNetworkSafeRetryClient(
	delegate Client,
	maxAttempts uint,
	retryDelay time.Duration,
	logger boshlog.Logger,
) Client

func NewRetryClient

func NewRetryClient(
	delegate Client,
	maxAttempts uint,
	retryDelay time.Duration,
	logger boshlog.Logger,
) Client

type DialContextFunc

type DialContextFunc func(ctx context.Context, network, address string) (net.Conn, error)

func SOCKS5DialContextFuncFromEnvironment

func SOCKS5DialContextFuncFromEnvironment(origDialer *net.Dialer, socks5Proxy ProxyDialer) DialContextFunc

func (DialContextFunc) DialContext

func (f DialContextFunc) DialContext(ctx context.Context, network, address string) (net.Conn, error)

type HTTPClient

type HTTPClient struct {
	// contains filtered or unexported fields
}

func NewHTTPClient

func NewHTTPClient(client Client, logger boshlog.Logger) *HTTPClient

func NewHTTPClientOpts

func NewHTTPClientOpts(client Client, logger boshlog.Logger, opts Opts) *HTTPClient

func (*HTTPClient) Delete

func (c *HTTPClient) Delete(endpoint string) (*http.Response, error)

func (*HTTPClient) DeleteCustomized

func (c *HTTPClient) DeleteCustomized(endpoint string, f func(*http.Request)) (*http.Response, error)

func (*HTTPClient) Get

func (c *HTTPClient) Get(endpoint string) (*http.Response, error)

func (*HTTPClient) GetCustomized

func (c *HTTPClient) GetCustomized(endpoint string, f func(*http.Request)) (*http.Response, error)

func (*HTTPClient) Post

func (c *HTTPClient) Post(endpoint string, payload []byte) (*http.Response, error)

func (*HTTPClient) PostCustomized

func (c *HTTPClient) PostCustomized(endpoint string, payload []byte, f func(*http.Request)) (*http.Response, error)

func (*HTTPClient) Put

func (c *HTTPClient) Put(endpoint string, payload []byte) (*http.Response, error)

func (*HTTPClient) PutCustomized

func (c *HTTPClient) PutCustomized(endpoint string, payload []byte, f func(*http.Request)) (*http.Response, error)

type Opts

type Opts struct {
	NoRedactUrlQuery bool
}

type ProxyDialer

type ProxyDialer interface {
	Dialer(string, string, string) (proxy.DialFunc, error)
}

type RequestRetryable

type RequestRetryable struct {
	// contains filtered or unexported fields
}

func NewRequestRetryable

func NewRequestRetryable(
	request *http.Request,
	delegate Client,
	logger boshlog.Logger,
	isResponseAttemptable func(*http.Response, error) (bool, error),
) *RequestRetryable

func (*RequestRetryable) Attempt

func (r *RequestRetryable) Attempt() (bool, error)

func (*RequestRetryable) Response

func (r *RequestRetryable) Response() *http.Response

Jump to

Keyboard shortcuts

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