Skip to content

Commit

Permalink
refactor: avoid calling strings.ToLower twice (#3433)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgbgbl committed Dec 22, 2022
1 parent 2285aa5 commit 297b664
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion recovery.go
Expand Up @@ -62,7 +62,9 @@ func CustomRecoveryWithWriter(out io.Writer, handle RecoveryFunc) HandlerFunc {
if ne, ok := err.(*net.OpError); ok {
var se *os.SyscallError
if errors.As(ne, &se) {
if strings.Contains(strings.ToLower(se.Error()), "broken pipe") || strings.Contains(strings.ToLower(se.Error()), "connection reset by peer") {
seStr := strings.ToLower(se.Error())
if strings.Contains(seStr, "broken pipe") ||
strings.Contains(seStr, "connection reset by peer") {
brokenPipe = true
}
}
Expand Down

0 comments on commit 297b664

Please sign in to comment.