Test_WWWAuthenticateOnlyOn401() — fiber Function Reference
Architecture documentation for the Test_WWWAuthenticateOnlyOn401() function in keyauth_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 520d11d5_887d_7dda_6a16_3eef541c9857["Test_WWWAuthenticateOnlyOn401()"] 71f55784_a001_0646_0ce7_7ad97067c49c["keyauth_test.go"] 520d11d5_887d_7dda_6a16_3eef541c9857 -->|defined in| 71f55784_a001_0646_0ce7_7ad97067c49c style 520d11d5_887d_7dda_6a16_3eef541c9857 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/keyauth/keyauth_test.go lines 996–1014
func Test_WWWAuthenticateOnlyOn401(t *testing.T) {
app := fiber.New()
app.Use(New(Config{
Validator: func(_ fiber.Ctx, _ string) (bool, error) {
return false, errors.New("invalid")
},
ErrorHandler: func(c fiber.Ctx, _ error) error {
return c.Status(fiber.StatusForbidden).SendString("forbidden")
},
}))
app.Get("/", func(c fiber.Ctx) error { return c.SendString("OK") })
req := httptest.NewRequest(fiber.MethodGet, "/", http.NoBody)
req.Header.Add("Authorization", "Bearer bad")
res, err := app.Test(req)
require.NoError(t, err)
require.Equal(t, http.StatusForbidden, res.StatusCode)
require.Empty(t, res.Header.Get("WWW-Authenticate"))
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_WWWAuthenticateOnlyOn401() do?
Test_WWWAuthenticateOnlyOn401() is a function in the fiber codebase, defined in middleware/keyauth/keyauth_test.go.
Where is Test_WWWAuthenticateOnlyOn401() defined?
Test_WWWAuthenticateOnlyOn401() is defined in middleware/keyauth/keyauth_test.go at line 996.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free