Test_Ctx_CustomCtx_and_Method() — fiber Function Reference
Architecture documentation for the Test_Ctx_CustomCtx_and_Method() function in ctx_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 1d15ab4e_1883_cb95_9633_ef2fd1dec950["Test_Ctx_CustomCtx_and_Method()"] 7b3d4933_5ae3_f84d_ff6d_0cb34e268026["ctx_test.go"] 1d15ab4e_1883_cb95_9633_ef2fd1dec950 -->|defined in| 7b3d4933_5ae3_f84d_ff6d_0cb34e268026 style 1d15ab4e_1883_cb95_9633_ef2fd1dec950 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
ctx_test.go lines 385–415
func Test_Ctx_CustomCtx_and_Method(t *testing.T) {
t.Parallel()
// Create app with custom request methods
methods := append(DefaultMethods, "JOHN") //nolint:gocritic // We want a new slice here
app := NewWithCustomCtx(func(app *App) CustomCtx {
return &customCtx{
DefaultCtx: *NewDefaultCtx(app),
}
}, Config{
RequestMethods: methods,
})
// Add route with custom method
app.Add([]string{"JOHN"}, "/doe", testEmptyHandler)
resp, err := app.Test(httptest.NewRequest("JOHN", "/doe", http.NoBody))
require.NoError(t, err, "app.Test(req)")
defer func() { require.NoError(t, resp.Body.Close()) }()
require.Equal(t, StatusOK, resp.StatusCode, "Status code")
body, err := io.ReadAll(resp.Body)
require.NoError(t, err, "io.ReadAll(resp.Body)")
require.Empty(t, body)
require.Empty(t, resp.Header.Get(HeaderContentType))
require.Equal(t, int64(0), resp.ContentLength)
// Add a new method
require.Panics(t, func() {
app.Add([]string{"JANE"}, "/jane", testEmptyHandler)
})
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_Ctx_CustomCtx_and_Method() do?
Test_Ctx_CustomCtx_and_Method() is a function in the fiber codebase, defined in ctx_test.go.
Where is Test_Ctx_CustomCtx_and_Method() defined?
Test_Ctx_CustomCtx_and_Method() is defined in ctx_test.go at line 385.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free