Skip to content

Commit

Permalink
Merge pull request #30 from danielgtaylor/lg/redact-jwt-quickfix
Browse files Browse the repository at this point in the history
fix: dont redact headers that dont exist
  • Loading branch information
lgarrett-isp committed Mar 15, 2022
2 parents ef18a59 + 162c485 commit 8498106
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion middleware/recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ func Recovery(onPanic PanicFunc) func(http.Handler) http.Handler {
}

for _, v := range RemovedHeaders {
r.Header.Set(v, redacted)
if r.Header.Get(v) != "" {
r.Header.Set(v, redacted)
}
}

// Recovering comes *after* the above so the buffer is not returned to
Expand Down

0 comments on commit 8498106

Please sign in to comment.