Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mna committed Mar 9, 2023
2 parents 0ccadf2 + 075425b commit 2f8a88f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rehttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,15 @@ type Transport struct {
// adds retry logic as per its configuration.
func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
var attempt int
preventRetry := req.Body != nil && t.PreventRetryWithBody
preventRetry := req.Body != nil && req.Body != http.NoBody && t.PreventRetryWithBody

// get the done cancellation channel for the context, will be nil
// for < go1.7.
done := contextForRequest(req)

// buffer the body if needed
var br *bytes.Reader
if req.Body != nil && !preventRetry {
if req.Body != nil && req.Body != http.NoBody && !preventRetry {
var buf bytes.Buffer
if _, err := io.Copy(&buf, req.Body); err != nil {
// cannot even try the first attempt, body has been consumed
Expand Down

0 comments on commit 2f8a88f

Please sign in to comment.