testDefaultOrEmptyConfig() — fiber Function Reference
Architecture documentation for the testDefaultOrEmptyConfig() function in cors_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 5d84b982_38fc_0361_6bc1_f6e2392e6bb3["testDefaultOrEmptyConfig()"] e59a43fd_cfa4_0f6b_1938_4a08e36ad74e["cors_test.go"] 5d84b982_38fc_0361_6bc1_f6e2392e6bb3 -->|defined in| e59a43fd_cfa4_0f6b_1938_4a08e36ad74e 45f18ca5_a57e_d27d_8c00_6335502c0043["Test_CORS_Defaults()"] 45f18ca5_a57e_d27d_8c00_6335502c0043 -->|calls| 5d84b982_38fc_0361_6bc1_f6e2392e6bb3 f82ea9a4_2476_05be_b8f5_de3324163ad9["Test_CORS_Empty_Config()"] f82ea9a4_2476_05be_b8f5_de3324163ad9 -->|calls| 5d84b982_38fc_0361_6bc1_f6e2392e6bb3 style 5d84b982_38fc_0361_6bc1_f6e2392e6bb3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/cors/cors_test.go lines 104–129
func testDefaultOrEmptyConfig(t *testing.T, app *fiber.App) {
t.Helper()
h := app.Handler()
// Test default GET response headers
ctx := &fasthttp.RequestCtx{}
ctx.Request.Header.SetMethod(fiber.MethodGet)
ctx.Request.Header.Set(fiber.HeaderOrigin, "http://localhost")
h(ctx)
require.Equal(t, "*", string(ctx.Response.Header.Peek(fiber.HeaderAccessControlAllowOrigin)))
require.Empty(t, string(ctx.Response.Header.Peek(fiber.HeaderAccessControlAllowCredentials)))
require.Empty(t, string(ctx.Response.Header.Peek(fiber.HeaderAccessControlExposeHeaders)))
// Test default OPTIONS (preflight) response headers
ctx = &fasthttp.RequestCtx{}
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.Equal(t, "GET, POST, HEAD, PUT, DELETE, PATCH", string(ctx.Response.Header.Peek(fiber.HeaderAccessControlAllowMethods)))
require.Empty(t, string(ctx.Response.Header.Peek(fiber.HeaderAccessControlAllowHeaders)))
require.Empty(t, string(ctx.Response.Header.Peek(fiber.HeaderAccessControlMaxAge)))
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does testDefaultOrEmptyConfig() do?
testDefaultOrEmptyConfig() is a function in the fiber codebase, defined in middleware/cors/cors_test.go.
Where is testDefaultOrEmptyConfig() defined?
testDefaultOrEmptyConfig() is defined in middleware/cors/cors_test.go at line 104.
What calls testDefaultOrEmptyConfig()?
testDefaultOrEmptyConfig() is called by 2 function(s): Test_CORS_Defaults, Test_CORS_Empty_Config.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free