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:
@@ -488,7 +488,13 @@ func setupTestServer(t *testing.T) *TestServerSetup {
|
|||||||
// Middleware
|
// Middleware
|
||||||
e.Use(echomiddleware.RequestLogger())
|
e.Use(echomiddleware.RequestLogger())
|
||||||
e.Use(echomiddleware.Recover())
|
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
|
// Setup routes using router package
|
||||||
routerConfig := &router.Config{
|
routerConfig := &router.Config{
|
||||||
|
|||||||
Reference in New Issue
Block a user