Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Attempts uint `envconfig:"APP_HTTP_RETRY_ATTEMPTS"` Delay time.Duration `envconfig:"APP_HTTP_RETRY_DELAY"` }
Config configuration for the HTTPExecutor
type ExecutableHTTPFunc ¶
ExecutableHTTPFunc defines a generic HTTP function to be executed
type HTTPExecutor ¶
type HTTPExecutor struct {
// contains filtered or unexported fields
}
HTTPExecutor is capable of executing HTTP requests with a leveraged retry mechanism for more resilience
func NewHTTPExecutor ¶
func NewHTTPExecutor(config *Config) *HTTPExecutor
NewHTTPExecutor constructs an HTTPExecutor based on the provided Config
func (*HTTPExecutor) Execute ¶
func (he *HTTPExecutor) Execute(doRequest ExecutableHTTPFunc) (*http.Response, error)
Execute wraps the provided ExecutableHTTPFunc with a retry mechanism and executes it
func (*HTTPExecutor) WithAcceptableStatusCodes ¶
func (he *HTTPExecutor) WithAcceptableStatusCodes(statusCodes []int)
WithAcceptableStatusCodes allows overriding the default acceptableStatusCodes values
Click to show internal directories.
Click to hide internal directories.