Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRoundTripper ¶
func NewRoundTripper(config Config) (http.RoundTripper, error)
NewRoundTripper returns a new http.RoundTripper with retry behaviour.
Types ¶
type Config ¶
type Config struct { BaseClient *http.Client // BaseTransport allows to specify a base http.RoundTripper. BaseTransport http.RoundTripper // Logger allows to specify a custom logger. *slog.Logger will satisfy this. Logger Logger // NextRetryInSecondsFunc allows to specify a custom retry function. // By default, exponential fibonacci like function is used. NextRetryInSecondsFunc NextRetryInSeconds // MaxRetries allows to specify the number of max retries before returning a fatal error. // 5 is the default. MaxRetries uint // RetryableStatusCodes allows to specify the retryable status codes. // defaultRetryableStatusCodes are the default. RetryableStatusCodes map[int]struct{} // AcceptedStatusCodes allows to specify the non-retryable status codes. // defaultAcceptedStatusCodes are the default. AcceptedStatusCodes map[int]struct{} }
Config allows configuring the client.
type Logger ¶
type Logger interface { Error(msg string, keysAndValues ...interface{}) Info(msg string, keysAndValues ...interface{}) Debug(msg string, keysAndValues ...interface{}) Warn(msg string, keysAndValues ...interface{}) }
Logger allows to inject a custom logger in the client.
type NextRetryInSeconds ¶
NextRetryInSeconds allows customising the behaviour for the calculating the next retry.
Click to show internal directories.
Click to hide internal directories.