Test_CORS_AllowOrigins_Vary() — fiber Function Reference
Architecture documentation for the Test_CORS_AllowOrigins_Vary() function in cors_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD ba1bab90_844c_0215_029a_ee6f8dac9459["Test_CORS_AllowOrigins_Vary()"] e59a43fd_cfa4_0f6b_1938_4a08e36ad74e["cors_test.go"] ba1bab90_844c_0215_029a_ee6f8dac9459 -->|defined in| e59a43fd_cfa4_0f6b_1938_4a08e36ad74e style ba1bab90_844c_0215_029a_ee6f8dac9459 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/cors/cors_test.go lines 131–156
func Test_CORS_AllowOrigins_Vary(t *testing.T) {
t.Parallel()
app := fiber.New()
app.Use(New(
Config{
AllowOrigins: []string{"http://localhost"},
},
))
h := app.Handler()
// Test Vary header non-Cors request
ctx := &fasthttp.RequestCtx{}
ctx.Request.Header.SetMethod(fiber.MethodGet)
h(ctx)
require.Contains(t, string(ctx.Response.Header.Peek(fiber.HeaderVary)), fiber.HeaderOrigin, "Vary header should be set")
// Test Vary header Cors request
ctx.Request.Reset()
ctx.Response.Reset()
ctx.Request.Header.SetMethod(fiber.MethodOptions)
ctx.Request.Header.Set(fiber.HeaderAccessControlRequestMethod, fiber.MethodGet)
ctx.Request.Header.Set(fiber.HeaderOrigin, "http://localhost")
h(ctx)
require.Contains(t, string(ctx.Response.Header.Peek(fiber.HeaderVary)), fiber.HeaderOrigin, "Vary header should be set")
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_CORS_AllowOrigins_Vary() do?
Test_CORS_AllowOrigins_Vary() is a function in the fiber codebase, defined in middleware/cors/cors_test.go.
Where is Test_CORS_AllowOrigins_Vary() defined?
Test_CORS_AllowOrigins_Vary() is defined in middleware/cors/cors_test.go at line 131.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free