utils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: MPL-2.0-no-copyleft-exception Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckStatus

func CheckStatus(resp *http.Response) error

CheckStatus returns error if the status is not 200 OK.

func Get

func Get(url *url.URL, client *http.Client) (*http.Response, error)

Get a *url.URL

func ParseJSON

func ParseJSON(reader io.Reader, dst interface{}) error

ParseJSON simplification of json.NewDecoder.

func RetryRequest

func RetryRequest(ctx context.Context, client *http.Client, req *http.Request, returnChan chan error) (resp *http.Response, retErr error)

RetryRequest attempts a request on the client repeatedly until it succeeds or the context is canceled. It will retry for time.Duration and back off slowly over several polls. If a channel is provided, it will return to the channel when the operation succeeds with any error if relevant, but only calling it sync will return the response.

Types

This section is empty.

Jump to

Keyboard shortcuts

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