httputil

package
v1.31.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewHTTPClient = defaultHTTPClientFactory

NewHTTPClient is a factory of HTTPClient

Functions

func GetTransport added in v1.9.1

func GetTransport(opts ...func(*http.Transport) error) (http.RoundTripper, error)

func UnmarshalResponse

func UnmarshalResponse(resp *http.Response) (interface{}, interface{}, error)

UnmarshalResponse takes an http Response and returns: - its body, deserialized if content-type appropriate - metadata such as headers and status code

func WithTLSClientAuth added in v1.9.1

func WithTLSClientAuth(cert tls.Certificate) func(*http.Transport) error

func WithTLSInsecureSkipVerify added in v1.9.1

func WithTLSInsecureSkipVerify(v bool) func(*http.Transport) error

func WithTLSRootCA added in v1.9.1

func WithTLSRootCA(caCert []byte) func(*http.Transport) error

WithTLSRootCA should be called only once, with multiple PEM encoded certificates as input if needed.

Types

type HTTPClient added in v1.3.0

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

HTTPClient is an interface for decoupling http.Client

type HTTPClientConfig added in v1.3.0

type HTTPClientConfig struct {
	Timeout        time.Duration
	FollowRedirect bool
	Transport      http.RoundTripper
}

HTTPClientConfig is a set of options used to initialize a HTTPClient

type UnmarshalFunc

type UnmarshalFunc func(action []byte, values interface{}) error

UnmarshalFunc is a type of function capable of taking the body of an http response and deserialize it into a target interface{}

Jump to

Keyboard shortcuts

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