client

package
v0.0.0-...-4f4ff30 Latest Latest
Warning

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

Go to latest
Published: May 9, 2021 License: Unlicense Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHTTPTransport

func GetHTTPTransport() *http.Transport

Types

type Client

type Client interface {
	HTTPGet(ctx context.Context, url string) (resp *http.Response, err error)
	HTTPGetBodyBytes(ctx context.Context, url string) ([]byte, error)
}

func Get

func Get() Client

Get returns current singleton instance of Client

func New

func New(transport *http.Transport) Client

New creates new HTTP client

type ClientWrapper

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

ClientWrapper offers basic http request methods

func (*ClientWrapper) HTTPGet

func (c *ClientWrapper) HTTPGet(ctx context.Context, url string) (resp *http.Response, err error)

HTTPGet does a HTTP GET request, checks the response to be a 200 OK and returns it

func (*ClientWrapper) HTTPGetBodyBytes

func (c *ClientWrapper) HTTPGetBodyBytes(ctx context.Context, url string) ([]byte, error)

HTTPGetBodyBytes reads the whole HTTP body and returns it

Jump to

Keyboard shortcuts

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