Skip to content

Commit

Permalink
Scope redirect fast-path to *url.Error only
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanuber committed Oct 25, 2019
1 parent 6f064ea commit 1fd4237
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions client.go
Expand Up @@ -354,13 +354,13 @@ func DefaultRetryPolicy(ctx context.Context, resp *http.Response, err error) (bo
}

if err != nil {
// Don't retry if the error was due to too many redirects.
if redirectsErrorRe.MatchString(err.Error()) {
return false, nil
}

// Don't retry if the error was due to TLS cert verification failure.
if v, ok := err.(*url.Error); ok {
// Don't retry if the error was due to too many redirects.
if redirectsErrorRe.MatchString(v.Error()) {
return false, nil
}

// Don't retry if the error was due to TLS cert verification failure.
if _, ok := v.Err.(x509.UnknownAuthorityError); ok {
return false, nil
}
Expand Down

0 comments on commit 1fd4237

Please sign in to comment.