reddit / baseplate.go

Reddit's Service Framework in Go
https://pkg.go.dev/github.com/reddit/baseplate.go
BSD 3-Clause "New" or "Revised" License
92 stars 77 forks source link

httpbp: Fix Retries middleware #647

Closed fishy closed 6 months ago

fishy commented 6 months ago

When we set GetBody in http.Request, it's expected that Body is also set, add special handling in Retries to make sure we also set Body when retrying when GetBody is also set before each retry attempt.

Also always clone the request before each retry attempt to avoid some subtle errors, and skip the Retries middleware altogether if Body is set but GetBody is not.

fishy commented 6 months ago

💇 Fixed this for real.