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