http

package
v0.20.7 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ETag        = "ETag"
	ContentType = "Content-Type"
)

Standard S3 HTTP response constants

Variables

This section is empty.

Functions

func DrainBody

func DrainBody(respBody io.ReadCloser)

DrainBody close non nil response with any response Body. convenient wrapper to drain any remaining data on response body.

Subsequently this allows golang http RoundTripper to re-use the same connection for future requests.

Types

type Client

type Client struct {
	Client *http.Client
}

Client is an HTTP Interface implementation

Define the structure of a http client and define the functions that are actually used

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do implement http.Client.Do()

func (*Client) Get

func (c *Client) Get(url string) (resp *http.Response, err error)

Get implements http.Client.Get()

func (*Client) Post

func (c *Client) Post(url, contentType string, body io.Reader) (resp *http.Response, err error)

Post implements http.Client.Post()

type ClientI

type ClientI interface {
	Get(url string) (resp *http.Response, err error)
	Post(url, contentType string, body io.Reader) (resp *http.Response, err error)
	Do(req *http.Request) (*http.Response, error)
}

ClientI interface with all functions to be implemented by mock when testing, it should include all HttpClient respective api calls that are used within this project.

Jump to

Keyboard shortcuts

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