From ec4b598728c290cbdae71e675c11be7b54fa55ea Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Fri, 6 Mar 2026 14:35:00 -0500 Subject: [PATCH] test(server): update CORS configuration in test helpers with explicit settings Replace default CORS middleware with explicit CORS configuration in test server setup to align with production security settings. This ensures test environment matches production behavior and prevents potential CORS-related test failures. Changes: - Replace echomiddleware.CORS() with echomiddleware.CORSWithConfig() - Configure allowed origins, methods, and headers explicitly - Set AllowCredentials to false for test environment - Add ExposeHeaders for Content-Length This maintains consistency with the CORS configuration applied to the main server in commit fb05c49. --- cmd/server/tests/test_helpers_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/server/tests/test_helpers_test.go b/cmd/server/tests/test_helpers_test.go index 89234b2..6785182 100644 --- a/cmd/server/tests/test_helpers_test.go +++ b/cmd/server/tests/test_helpers_test.go @@ -488,7 +488,13 @@ func setupTestServer(t *testing.T) *TestServerSetup { // Middleware e.Use(echomiddleware.RequestLogger()) e.Use(echomiddleware.Recover()) - e.Use(echomiddleware.CORS()) + e.Use(echomiddleware.CORSWithConfig(echomiddleware.CORSConfig{ + AllowOrigins: []string{"*"}, + AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}, + AllowHeaders: []string{"Origin", "Content-Type", "Authorization"}, + ExposeHeaders: []string{"Content-Length"}, + AllowCredentials: false, + })) // Setup routes using router package routerConfig := &router.Config{