Documentation ¶
Index ¶
- Constants
- func DrainBody(resp *http.Response)
- func IsRetryOtherResponse(resp *http.Response) (bool, *url.URL)
- func IsThrottleResponse(resp *http.Response, err error) (bool, time.Duration)
- func IsUnavailableResponse(resp *http.Response, err error) bool
- func StatusCodeFromError(err error) (statusCode int, ok bool)
Constants ¶
View Source
const ( StatusCodeRetryOther = http.StatusPermanentRedirect StatusCodeThrottle = http.StatusTooManyRequests )
Variables ¶
This section is empty.
Functions ¶
func DrainBody ¶
DrainBody reads then closes a response's body if it is non-nil. This function should be deferred before a response reference is discarded.
func IsThrottleResponse ¶
func StatusCodeFromError ¶
StatusCodeFromError retrieves the 'statusCode' parameter from the provided werror. If the error is not a werror or does not have the statusCode param, ok is false.
The default client error decoder sets the statusCode parameter on its returned errors. Note that, if a custom error decoder is used, this function will only return a status code for the error if the custom decoder sets a 'statusCode' parameter on the error.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.