Skip to content

Commit

Permalink
test(e2e): fix unsable CORS cases
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Dec 14, 2024
1 parent 6335ec2 commit 14b56de
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions e2e/cases/server/cors/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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',
);
Expand Down

0 comments on commit 14b56de

Please sign in to comment.