# Functions
BasicAuthorizer creates an Authorizer for HTTP Basic Auth https://en.wikipedia.org/wiki/Basic_access_authentication.
DefaultResponseTester returns true if the response status code is between 200 and 399 (inclusive).
ExampleRetryAfterRequester uses a requester that will detect a Retry-After header and retry the request after the provided number of seconds.
HeaderAuthorizer creates an Authorizer for arbitrary header values This is used for apis that implement a static auth token Like `X-Auth-Token: 4200322b-2073-4e85-9186-959b2f4c49d1`.
HTTPClient makes fresh `http.Client` that mimics `http.DefaultClient`.
NewErrorHTTPResponse converts a http response into an error.
NewErrorHTTPResponseLimitBody converts a http response into an error.
NewRetryableRequest helps create http requests that can be retried It is preferable to give a body which implements `Len() int` Known Content-Length: - `nil` - `*bytes.Buffer` - `*bytes.Reader` - `*strings.Reader` - `string` - `[]rune` - `[]byte` - `encoding.BinaryMarshaler` - `encoding.TextMarshaler`
Potentially unknown Content-Length: - `io.ReadSeeker` - `func() (io.ReadCloser, error)` - `io.Reader`: This is tested last.
ResponseTesterStatusCodes wraps a `ResponseTester` that will test status codes If the response exists, it return the corresponding boolean that matches the status code in the map provided If there is no match, it will delegate to the given `tester` If no `tester` was given: - Request errors are returned immediately without testing the response code (it is assumed that response is nil in this case) - Unmatched response codes will convert the entire response to `ErrorHTTPResponse`.
TryCount extracts the retry count from the request context
try := TryCount(req).
WithTryCount sets try count in the request context
req = WithTryCount(req, uint(1)).
# Constants
DefaultRetryAttempts is used when no attempt count is given.
1MB.
# Variables
ErrBodyNotReReadable is returned by NewRetryableRequest when the given body cannot be re-read.
# Structs
AuthorizedRequester adds authorization to outgoing requests.
ErrorHTTPResponse contains an error response from an HTTP request.
LoggingRequester may log the request and response.
RetryAfterRequester will retry requests.
RetryBackoffRequester performs a request with retries, using the provided backoff strategy between each attempt.
ThrottledRequester waits before sending a request using the associated Waiter.
# Type aliases
Authorizer adds authorization information to a request.
Backoff policy implements this interface which returns the duration that should be waited between each try at a given 'try' number.
ResponseTester tests the results returned by Requester.Do If the response is successful, it will return true, otherwise it returns false.