Test_Static_NotFoundHandler() — fiber Function Reference
Architecture documentation for the Test_Static_NotFoundHandler() function in static_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD c5323be5_e6a1_7186_f02d_9473146dc62d["Test_Static_NotFoundHandler()"] f26a2d79_1e01_f027_82eb_45c4308747e8["static_test.go"] c5323be5_e6a1_7186_f02d_9473146dc62d -->|defined in| f26a2d79_1e01_f027_82eb_45c4308747e8 style c5323be5_e6a1_7186_f02d_9473146dc62d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/static/static_test.go lines 185–204
func Test_Static_NotFoundHandler(t *testing.T) {
t.Parallel()
app := fiber.New()
app.Get("/*", New("../../.github", Config{
NotFoundHandler: func(c fiber.Ctx) error {
return c.SendString("Custom 404")
},
}))
resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/not-found", http.NoBody))
require.NoError(t, err, "app.Test(req)")
require.Equal(t, 404, resp.StatusCode, "Status code")
require.NotEmpty(t, resp.Header.Get(fiber.HeaderContentLength))
require.Equal(t, fiber.MIMETextPlainCharsetUTF8, resp.Header.Get(fiber.HeaderContentType))
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
require.Equal(t, "Custom 404", string(body))
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_Static_NotFoundHandler() do?
Test_Static_NotFoundHandler() is a function in the fiber codebase, defined in middleware/static/static_test.go.
Where is Test_Static_NotFoundHandler() defined?
Test_Static_NotFoundHandler() is defined in middleware/static/static_test.go at line 185.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free