utils

package
v0.0.0-...-f0f0ab8 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckErr

func CheckErr(descr string, isErr bool, err error) error

CheckErr : Helper function for tests. Check if a given error was expected.

params :- a. desc string Description of the error in case of failure b. isError bool Whether the error was expected or not c. err error Error to check

returns :- a. error Error if any

func GetRequest

func GetRequest(url string, retryDuration time.Duration) (*http.Response, error)

GetRequest : Make a GET request to the given URL. Uses exponential retries with backoff.

params :- a. url string URL to make the request to b. retryDuration time.Duration Duration to wait between retries

returns :- a. http.Response Response from the request b. error Error if any

func PostRequest

func PostRequest(url, contentType string, body io.Reader, retry bool, retryDuration time.Duration) (*http.Response, error)

PostRequest : Make a POST request to the given URL. Uses exponential retries with backoff optionally.

params :- a. url string URL to make the request to b. retry bool True if retries should be done c. retryDuration time.Duration Duration to wait between retries

returns :- a. http.Response Response from the request b. error Error if any

Types

This section is empty.

Jump to

Keyboard shortcuts

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