cosmos-explorer/test/CORSBypass.ts
sunghyunkang1111 bb66deb3a4
Added more test cases and fix system partition key load issue (#2126)
* Added more test cases and fix system partition key load issue

* Fix unit tests and fix ci

* Updated test snapsho
2025-04-30 15:18:11 -05:00

24 lines
627 B
TypeScript

import { Page } from "@playwright/test";
export async function setupCORSBypass(page: Page) {
await page.route("**/api/mongo/explorer{,/**}", async (route) => {
const response = await route.fetch({
headers: {
...route.request().headers(),
},
});
await route.fulfill({
status: response.status(),
headers: {
...response.headers(),
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "*",
"Access-Control-Allow-Headers": "*",
"Access-Control-Allow-Credentials": "*",
},
body: await response.body(),
});
});
}