Documentation ¶
Overview ¶
Package retryableRequest provides a function to retry an http request up to a configured number of retries. It builds on retryablehttp, but works with the default http.Client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepCopyRequest ¶
DeepCopyRequest returns a deep copy of the request. The context of the original request is placed by context.Background. An error indicates a problem with the http request. In that case the passed request should no longer be used.
func ExecuteRequestWithRetry ¶
func ExecuteRequestWithRetry(ctx context.Context, client *http.Client, request *http.Request, maxRetries int, retryWaitMin, retryWaitMax time.Duration, ) (*http.Response, error)
ExecuteRequestWithRetry executes the given request via the passed http client and retries on failures. An error is only returned if there was a non retryable error or the maximum number of retries was reached. It uses the retry policy of retryablehttp.ErrorPropagatedRetryPolicy and exponential backoff from retryablehttp.DefaultBackoff.
Types ¶
This section is empty.