Skip to content

Commit

Permalink
Check status code before retrying request
Browse files Browse the repository at this point in the history
Signed-off-by: Cenk Alti <cenkalti@gmail.com>
(cherry picked from commit 442d594)
  • Loading branch information
cenkalti authored and mattfarina committed Jan 13, 2023
1 parent 9d8fee1 commit ee1ec6e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/cli/roundtripper.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ func (rt *retryingRoundTripper) roundTrip(req *http.Request, retry int, prevResp
if rtErr != nil {
return resp, rtErr
}
if resp.StatusCode < 500 {
return resp, rtErr
}
if resp.Header.Get("content-type") != "application/json" {
return resp, rtErr
}
Expand Down

0 comments on commit ee1ec6e

Please sign in to comment.