TestPanicWithBrokenPipe() — gin Function Reference
Architecture documentation for the TestPanicWithBrokenPipe() function in recovery_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD 602ea038_8d80_b1ba_5e1f_0e0190cd4f7e["TestPanicWithBrokenPipe()"] c9a553a7_05a4_91a7_23b0_924f9f59d021["recovery_test.go"] 602ea038_8d80_b1ba_5e1f_0e0190cd4f7e -->|defined in| c9a553a7_05a4_91a7_23b0_924f9f59d021 style 602ea038_8d80_b1ba_5e1f_0e0190cd4f7e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
recovery_test.go lines 98–129
func TestPanicWithBrokenPipe(t *testing.T) {
const expectCode = 204
expectErrnos := []syscall.Errno{
syscall.EPIPE,
syscall.ECONNRESET,
}
for _, errno := range expectErrnos {
t.Run("Recovery from "+errno.Error(), func(t *testing.T) {
var buf strings.Builder
router := New()
router.Use(RecoveryWithWriter(&buf))
router.GET("/recovery", func(c *Context) {
// Start writing response
c.Header("X-Test", "Value")
c.Status(expectCode)
// Oops. Client connection closed
e := &net.OpError{Err: &os.SyscallError{Err: errno}}
panic(e)
})
// RUN
w := PerformRequest(router, http.MethodGet, "/recovery")
// TEST
assert.Equal(t, expectCode, w.Code)
assert.Contains(t, strings.ToLower(buf.String()), errno.Error())
assert.NotContains(t, strings.ToLower(buf.String()), "[Recovery]")
})
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TestPanicWithBrokenPipe() do?
TestPanicWithBrokenPipe() is a function in the gin codebase, defined in recovery_test.go.
Where is TestPanicWithBrokenPipe() defined?
TestPanicWithBrokenPipe() is defined in recovery_test.go at line 98.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free