utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleRecovered

func HandleRecovered(r interface{}, logger *logrus.Logger) (err error)

HandleRecovered logs a recovered panic

Types

type HTTPClient

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

HTTPClient represents the HTTPClient infos

func NewHTTPClient

func NewHTTPClient(baseURL string, options HTTPOptions) *HTTPClient

NewHTTPClient creates an HTTP requester object

func (*HTTPClient) Call

func (r *HTTPClient) Call(path, method string, body io.Reader, headers map[string]string) (*HTTPResponse, error)

Call executes request with retries and returns response body, headers, status code and error

type HTTPOptions

type HTTPOptions struct {
	Retries int
	Timeout time.Duration
	Headers map[string]string
}

HTTPOptions represents the options for the HTTPRequest object

type HTTPResponse

type HTTPResponse struct {
	Body       []byte
	Headers    http.Header
	StatusCode int
}

HTTPResponse represents the HTTPResponse infos

Jump to

Keyboard shortcuts

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