httputil

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewHTTPClient = defaultHTTPClientFactory

NewHTTPClient is a factory of HTTPClient

Functions

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

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