mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-24 19:09:57 +08:00
add ToLower()
This commit is contained in:
parent
e6e3596e1d
commit
34285b75b8
@ -45,7 +45,7 @@ func RecoveryWithWriter(out io.Writer) HandlerFunc {
|
|||||||
var brokenPipe bool
|
var brokenPipe bool
|
||||||
if ne, ok := err.(*net.OpError); ok {
|
if ne, ok := err.(*net.OpError); ok {
|
||||||
if se, ok := ne.Err.(*os.SyscallError); ok {
|
if se, ok := ne.Err.(*os.SyscallError); ok {
|
||||||
if strings.Contains(se.Error(), "broken pipe") || strings.Contains(se.Error(), "connection reset") {
|
if strings.Contains(strings.ToLower(se.Error()), "broken pipe") || strings.Contains(strings.ToLower(se.Error()), "connection reset") {
|
||||||
brokenPipe = true
|
brokenPipe = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,8 +84,8 @@ func TestPanicWithBrokenPipe(t *testing.T) {
|
|||||||
const expectCode = 204
|
const expectCode = 204
|
||||||
|
|
||||||
expectMsgs := map[syscall.Errno]string{
|
expectMsgs := map[syscall.Errno]string{
|
||||||
syscall.EPIPE: "broken pipe",
|
syscall.EPIPE: "Broken pipe",
|
||||||
syscall.ECONNRESET: "connection reset",
|
syscall.ECONNRESET: "connection reset by peer",
|
||||||
}
|
}
|
||||||
|
|
||||||
for errno, expectMsg := range expectMsgs {
|
for errno, expectMsg := range expectMsgs {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user