Test_CORS_setSimpleHeaders_NilConfig ensures the nil-config guard returns without panicking or mutating the response headers.
(t *testing.T)
| 1707 | // Test_CORS_setSimpleHeaders_NilConfig ensures the nil-config guard returns |
| 1708 | // without panicking or mutating the response headers. |
| 1709 | func Test_CORS_setSimpleHeaders_NilConfig(t *testing.T) { |
| 1710 | t.Parallel() |
| 1711 | |
| 1712 | app := fiber.New() |
| 1713 | c := app.AcquireCtx(&fasthttp.RequestCtx{}) |
| 1714 | defer app.ReleaseCtx(c) |
| 1715 | |
| 1716 | require.NotPanics(t, func() { |
| 1717 | setSimpleHeaders(c, "https://example.com", nil) |
| 1718 | }) |
| 1719 | require.Empty(t, string(c.Response().Header.Peek(fiber.HeaderAccessControlAllowOrigin))) |
| 1720 | } |
| 1721 | |
| 1722 | // Test_CORS_setSimpleHeaders_WildcardWithCredentials verifies that when |
| 1723 | // AllowCredentials is true and the resolved origin is "*", the middleware logs |
nothing calls this directly
no test coverage detected