Skip to content

Commit

Permalink
fix: print headers without Authorization header on broken pipe (#2528)
Browse files Browse the repository at this point in the history
Co-authored-by: thinkerou <thinkerou@gmail.com>
  • Loading branch information
zachnewburgh and thinkerou authored Oct 15, 2020
1 parent 1297966 commit a7a6986
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ func CustomRecoveryWithWriter(out io.Writer, handle RecoveryFunc) HandlerFunc {
headers[idx] = current[0] + ": *"
}
}
headersToStr := strings.Join(headers, "\r\n")
if brokenPipe {
logger.Printf("%s\n%s%s", err, string(httpRequest), reset)
logger.Printf("%s\n%s%s", err, headersToStr, reset)
} else if IsDebugging() {
logger.Printf("[Recovery] %s panic recovered:\n%s\n%s\n%s%s",
timeFormat(time.Now()), strings.Join(headers, "\r\n"), err, stack, reset)
timeFormat(time.Now()), headersToStr, err, stack, reset)
} else {
logger.Printf("[Recovery] %s panic recovered:\n%s\n%s%s",
timeFormat(time.Now()), err, stack, reset)
Expand Down

0 comments on commit a7a6986

Please sign in to comment.