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.
This commit is contained in:
2026-03-06 14:35:00 -05:00
parent 994afe8250
commit ec4b598728
+7 -1
View File
@@ -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{