mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 13:22:09 +08:00
refactor: avoid calling strings.ToLower twice
This commit is contained in:
parent
cc367f9125
commit
2a8c7e1ba0
@ -62,7 +62,9 @@ func CustomRecoveryWithWriter(out io.Writer, handle RecoveryFunc) HandlerFunc {
|
|||||||
if ne, ok := err.(*net.OpError); ok {
|
if ne, ok := err.(*net.OpError); ok {
|
||||||
var se *os.SyscallError
|
var se *os.SyscallError
|
||||||
if errors.As(ne, &se) {
|
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
|
brokenPipe = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user