mirror of https://github.com/gin-gonic/gin.git
fix: print headers without Authorization header on broken pipe (#2528)
Co-authored-by: thinkerou <thinkerou@gmail.com>
This commit is contained in:
parent
1297966100
commit
a7a6986d73
|
@ -76,11 +76,12 @@ func CustomRecoveryWithWriter(out io.Writer, handle RecoveryFunc) HandlerFunc {
|
||||||
headers[idx] = current[0] + ": *"
|
headers[idx] = current[0] + ": *"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
headersToStr := strings.Join(headers, "\r\n")
|
||||||
if brokenPipe {
|
if brokenPipe {
|
||||||
logger.Printf("%s\n%s%s", err, string(httpRequest), reset)
|
logger.Printf("%s\n%s%s", err, headersToStr, reset)
|
||||||
} else if IsDebugging() {
|
} else if IsDebugging() {
|
||||||
logger.Printf("[Recovery] %s panic recovered:\n%s\n%s\n%s%s",
|
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 {
|
} else {
|
||||||
logger.Printf("[Recovery] %s panic recovered:\n%s\n%s%s",
|
logger.Printf("[Recovery] %s panic recovered:\n%s\n%s%s",
|
||||||
timeFormat(time.Now()), err, stack, reset)
|
timeFormat(time.Now()), err, stack, reset)
|
||||||
|
|
Loading…
Reference in New Issue