From 5d5c7256c098551e9ad2c385eba002c6a8a265ac Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 14 Dec 2024 17:37:30 +0800 Subject: [PATCH] test(e2e): fix unsable CORS cases (#4195) --- e2e/cases/server/cors/index.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/e2e/cases/server/cors/index.test.ts b/e2e/cases/server/cors/index.test.ts index 9765657f93..b31c2433a6 100644 --- a/e2e/cases/server/cors/index.test.ts +++ b/e2e/cases/server/cors/index.test.ts @@ -10,7 +10,7 @@ test('should include CORS headers by default for dev server', async ({ page, }); - const response = await request.get(`http://localhost:${rsbuild.port}`); + const response = await request.get(`http://127.0.0.1:${rsbuild.port}`); expect(response.headers()['access-control-allow-origin']).toEqual('*'); await rsbuild.close(); @@ -25,7 +25,7 @@ test('should include CORS headers by default for preview server', async ({ page, }); - const response = await request.get(`http://localhost:${rsbuild.port}`); + const response = await request.get(`http://127.0.0.1:${rsbuild.port}`); expect(response.headers()['access-control-allow-origin']).toEqual('*'); await rsbuild.close(); @@ -42,7 +42,7 @@ test('should allow to disable CORS', async ({ page, request }) => { }, }); - const response = await request.get(`http://localhost:${rsbuild.port}`); + const response = await request.get(`http://127.0.0.1:${rsbuild.port}`); expect(response.headers()).not.toHaveProperty('access-control-allow-origin'); await rsbuild.close(); @@ -61,7 +61,7 @@ test('should allow to configure CORS', async ({ page, request }) => { }, }); - const response = await request.get(`http://localhost:${rsbuild.port}`); + const response = await request.get(`http://127.0.0.1:${rsbuild.port}`); expect(response.headers()['access-control-allow-origin']).toEqual( 'https://example.com', );