retryablehttp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAndRewindHttpResponseBody

func GetAndRewindHttpResponseBody(resp *http.Response) ([]byte, stackerr.Error)

func GetRetryhttpLeveledLogger

func GetRetryhttpLeveledLogger(loggerConfigFunc func(log.NewInput) log.NewInput) retryablehttp.LeveledLogger

func NewRoundTripper

func NewRoundTripper(input *NewClientInput) http.RoundTripper

Types

type NewClientInput

type NewClientInput struct {
	// The maximum size, in bytes, of the cache. A cache will
	// only be used if this value is non-zero.
	CacheMaxSizeBytes int64
	// 0 for never expiring
	CacheMaxAgeSeconds int64
	// The base transport settings to use.
	// This is not used for embedded Tor clients.
	RoundTripper http.RoundTripper
	// The maximum number of retries for each request. If less
	// than 0, it will be treated as unlimited (technically,
	// max int32)
	MaxRetries int
	// The minimum amount of time to wait between retries
	RetryWaitMin time.Duration
	// The maximum amount of time to wait between retries
	RetryWaitMax time.Duration
	// The logger to use. If not provided, the default one
	// will be used.
	Logger hashicorphttp.LeveledLogger
	// A custom backoff function, if desired
	Backoff func(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration
	// A custom retry function, if desired
	CheckRetry func(ctx context.Context, resp *http.Response, httpErr error) (bool, error)
}

Jump to

Keyboard shortcuts

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