Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/tests-e2e/tests/appRouter/middleware.rewrite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ test("Middleware Rewrite External Image", async ({ page }) => {
});

test("Middleware Rewrite Status Code", async ({ page }) => {
// Need to set up the event before navigating to the page to avoid missing it
// We need to check the URL here also cause there will be multiple responses (i.e the fonts, css, js, etc)
page.on("response", async (response) => {
// Need to set up the event before navigating to the page to avoid missing it
// We need to check the URL here also cause there will be multiple responses (i.e the fonts, css, js, etc)
if (response.url() === "/rewrite-status-code") {
// `response.url()` will be the full URL including the host, so we need to check the pathname
if (new URL(response.url()).pathname === "/rewrite-status-code") {
expect(response.status()).toBe(403);
}
});
Expand Down
Loading