httpreq

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoRequest

func DoRequest(f RequestFunc, insecureSkipVerify bool) (*http.Response, []byte, *httperr.Error)

DoRequest sends HTTP requests and returns HTTP response

func DoRequestWithRetries

func DoRequestWithRetries(f RequestFunc, insecureSkipVerify bool) ([]byte, *httperr.Error)

DoRequestWithRetries sends HTTP requests and returns HTTP response; retries if needed

func GetNextBackoff added in v0.3.0

func GetNextBackoff(resp *http.Response, initialBackoff time.Duration, attempt int) time.Duration

GetNextBackoff determines the retry delay from Retry-After header or exponential backoff

func GetURL added in v0.3.0

func GetURL(baseURL string, query map[string]string, paths ...string) (string, *httperr.Error)

GetURL builds a fully-qualified URL from a base URL, optional path segments, and optional query parameters.

func ParseRetryAfter added in v0.3.0

func ParseRetryAfter(resp *http.Response) (time.Duration, bool)

func ShouldRetry added in v0.3.0

func ShouldRetry(status int) bool

ShouldRetry returns true if the given HTTP status code is retryable

Types

type RequestFunc

type RequestFunc func() (*http.Request, *httperr.Error)

func GetRequestFunc added in v0.3.0

func GetRequestFunc(ctx context.Context, method string, headers, query map[string]string, payload []byte, baseUrl string, paths ...string) RequestFunc

Jump to

Keyboard shortcuts

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