Skip to content

Commit

Permalink
Merge pull request #572 from danielgtaylor/v1-fix-recovery-buffer
Browse files Browse the repository at this point in the history
fix: reset recovery middleware buffer
  • Loading branch information
danielgtaylor authored Sep 11, 2024
2 parents 100b20c + 8684ae1 commit a0d7a96
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions middleware/recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func Recovery(onPanic PanicFunc) func(http.Handler) http.Handler {
if r.Body != nil {
// Get a buffer that the body will be read into.
buf = bufPool.Get().(*bytes.Buffer)
buf.Reset()
defer bufPool.Put(buf)

r.Body = newBufferedReadCloser(r.Body, buf, MaxLogBodyBytes)
Expand Down

0 comments on commit a0d7a96

Please sign in to comment.