Documentation ¶
Overview ¶
Package retryafter contains a utility function for parsing the Retry-After HTTP header.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse parses the backoff time specified in the Retry-After header if present. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After.
The second parameter is the fallback duration to use if the header is not present or invalid.
Example:
time.Sleep(retryafter.Parse(resp.Header.Get("Retry-After"), 5*time.Second))
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.