TestTimeout_PanicAfterTimeout() — fiber Function Reference
Architecture documentation for the TestTimeout_PanicAfterTimeout() function in timeout_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD e91a3a38_7b2c_c7a0_20c9_8d017e7bc6f9["TestTimeout_PanicAfterTimeout()"] bab1b67e_4e42_cfe9_38ec_3f1f6a839718["timeout_test.go"] e91a3a38_7b2c_c7a0_20c9_8d017e7bc6f9 -->|defined in| bab1b67e_4e42_cfe9_38ec_3f1f6a839718 style e91a3a38_7b2c_c7a0_20c9_8d017e7bc6f9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/timeout/timeout_test.go lines 343–367
func TestTimeout_PanicAfterTimeout(t *testing.T) {
t.Parallel()
app := fiber.New()
panicDone := make(chan struct{})
app.Get("/panic-after-timeout", New(func(c fiber.Ctx) error {
<-c.Context().Done()
defer close(panicDone)
panic("panic after timeout")
}, Config{Timeout: 20 * time.Millisecond}))
req := httptest.NewRequest(fiber.MethodGet, "/panic-after-timeout", http.NoBody)
resp, err := app.Test(req)
require.NoError(t, err)
// With immediate return, we get 408 (not 500) because panic happens after middleware returned
require.Equal(t, fiber.StatusRequestTimeout, resp.StatusCode)
// Wait for panic to occur and be handled by cleanup goroutine
select {
case <-panicDone:
case <-time.After(200 * time.Millisecond):
t.Fatal("panic did not occur")
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TestTimeout_PanicAfterTimeout() do?
TestTimeout_PanicAfterTimeout() is a function in the fiber codebase, defined in middleware/timeout/timeout_test.go.
Where is TestTimeout_PanicAfterTimeout() defined?
TestTimeout_PanicAfterTimeout() is defined in middleware/timeout/timeout_test.go at line 343.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free