http

package
v1.0.16 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ClientTimeoutEnvKey string = "NV_HTTP_CLIENT_TIMEOUT"

Variables

This section is empty.

Functions

func NewRetryableClient

func NewRetryableClient(ctx context.Context, opts ...Option) *http.Client

NewRetryableClient creates a retryablehttp.Client with the provided options

Types

type ClientOptions

type ClientOptions struct {
	RetryWaitMin time.Duration
	RetryWaitMax time.Duration
	RetryMax     int
	CheckRetry   retryablehttp.CheckRetry
	Backoff      retryablehttp.Backoff
	ErrorHandler retryablehttp.ErrorHandler
	PrepareRetry retryablehttp.PrepareRetry
}

Retryable client options.

type Option

type Option func(*features)

func WithAppVersionUserAgent

func WithAppVersionUserAgent(appName string) Option

WithAppVersionUserAgent when called will add a User-Agent header to each client request with the provided appName plus the version.

func WithClientOptions

func WithClientOptions(co ClientOptions) Option

WithClientOptions sets retryablehttp.Client fields corresponding to those in co.

func WithClientTimeout

func WithClientTimeout(timeout time.Duration) Option

WithClientTimeout specifies the HTTP client's timeout it's recommended to set the timeout to something 30 seconds or greater due to the retryable client timeout being included in this value

func WithRequestHeader

func WithRequestHeader(key string, value string) Option

WithRequestHeader overwrites request header for all requests

Jump to

Keyboard shortcuts

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