Documentation
¶
Overview ¶
wraps retry logic in overrides to http.Client
Index ¶
- Constants
- func AddAuthorizationHeader(req *http.Request, bearerToken string)
- func AddContentTypeJson(req *http.Request)
- func AddContentTypeUrlEncoded(req *http.Request)
- func AddRequestHeader(req *http.Request, key, value string)
- func AddUserAgentHeader(req *http.Request)
- func CloseBodyReader(rc io.ReadCloser)
- func DoFormat(bytes []byte, v common.Values, f string)
- func RetryWait(count int64, fn func() bool) bool
- type Client
- func (c *Client) Get(url string) (*http.Response, error)
- func (c *Client) Post(url string, body io.Reader) (*http.Response, error)
- func (c *Client) RetriableDo(req *http.Request) (*http.Response, error)
- func (c *Client) RetryWithBackoff(logger *config.Log, i int64, resp *http.Response, err error) bool
- type Do
Constants ¶
View Source
const ( Authorization = "Authorization" ContentType = "Content-Type" UserAgent = "User-Agent" CliUserAgent = "tcli" )
View Source
const ( RetryAfter = "Retry-After" DefaultRetryAfterSeconds = time.Second * 3 DefaultRetryCount = 3 )
Variables ¶
This section is empty.
Functions ¶
func AddAuthorizationHeader ¶
add authorization header to http request
func AddContentTypeJson ¶
add content type application/json
func AddContentTypeUrlEncoded ¶
add content type url encoded
func AddRequestHeader ¶
generic add header
Types ¶
type Client ¶
func RetriableClientWithStatus ¶
retry enabled client with specific status code to wait for e.g. wait for 200 OK
func (*Client) RetriableDo ¶
retry logic
Click to show internal directories.
Click to hide internal directories.