Documentation
¶
Index ¶
Constants ¶
const ClientTimeoutEnvKey string = "NV_HTTP_CLIENT_TIMEOUT"
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 ¶
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 ¶
WithRequestHeader overwrites request header for all requests
func WithTransportWrapper ¶
func WithTransportWrapper(wrap func(http.RoundTripper) http.RoundTripper) Option
WithTransportWrapper wraps the client's transport with the provided function. The wrapper is applied as the outermost transport layer, so it observes each logical request (including retries) and its final outcome. It lets callers add cross-cutting transport behaviour such as metrics without this package taking a dependency on the wrapper's implementation. A nil wrapper is ignored.