httpclient

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: Apache-2.0 Imports: 23 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 MakeReplayable

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

func NewMutualTLSClient

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

func ReInitializeDefaultDialer

func ReInitializeDefaultDialer()

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 DialFunc

type DialFunc func(network, address string) (net.Conn, error)

func SOCKS5DialFuncFromEnvironment

func SOCKS5DialFuncFromEnvironment(origDialer DialFunc, socks5Proxy ProxyDialer) DialFunc

func (DialFunc) Dial

func (f DialFunc) Dial(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