From 14b56de2f0ed6d7d7a9a53d70096eebeacf69bb3 Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 14 Dec 2024 16:36:07 +0800 Subject: [PATCH] test(e2e): fix unsable CORS cases --- 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', );