var nopCancelFunc context.CancelFunc = func() {}
-var reqErrorRe = regexp.MustCompile(`net/http: invalid header `)
-
// Do augments (*http.Client)Do(): adds Authorization and X-Request-Id
// headers, delays in order to comply with rate-limiting restrictions,
// and retries failed requests when appropriate.
if c.Timeout == 0 {
return false, nil
}
- // This check can be removed when
- // https://github.com/hashicorp/go-retryablehttp/pull/210
- // (or equivalent) is merged and we update go.mod.
- // Until then, it is needed to pass
- // TestNonRetryableStdlibError.
- if respErr != nil && reqErrorRe.MatchString(respErr.Error()) {
- return false, nil
- }
retrying, err := retryablehttp.DefaultRetryPolicy(ctx, resp, respErr)
if retrying {
lastResp, lastRespBody, lastErr = resp, nil, respErr