mirror of
https://github.com/gin-gonic/gin.git
synced 2026-07-12 05:51:12 +08:00
Compare commits
2 Commits
4306aaa17e
...
1d649526f8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d649526f8 | ||
|
|
69c0ff1f8d |
@ -68,12 +68,9 @@ func CustomRecoveryWithWriter(out io.Writer, handle RecoveryFunc) HandlerFunc {
|
||||
}
|
||||
}
|
||||
}
|
||||
if e, ok := err.(error); ok {
|
||||
// ErrAbortHandler should be treated as broken pipe too.
|
||||
if errors.Is(e, http.ErrAbortHandler) {
|
||||
brokenPipe = true
|
||||
}
|
||||
}
|
||||
if e, ok := err.(error); ok && errors.Is(e, http.ErrAbortHandler) {
|
||||
brokenPipe = true
|
||||
}
|
||||
if logger != nil {
|
||||
const stackSkip = 3
|
||||
if brokenPipe {
|
||||
|
||||
@ -161,7 +161,9 @@ func TestPanicWithAbortHandler(t *testing.T) {
|
||||
w := PerformRequest(router, http.MethodGet, "/recovery")
|
||||
// TEST
|
||||
assert.Equal(t, expectCode, w.Code)
|
||||
assert.Contains(t, buf.String(), "net/http: abort Handler")
|
||||
out := buf.String()
|
||||
assert.Contains(t, out, "net/http: abort Handler")
|
||||
assert.NotContains(t, out, "panic recovered")
|
||||
}
|
||||
|
||||
func TestCustomRecoveryWithWriter(t *testing.T) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user