Skip to content

Commit d89bd75

Browse files
sommeeeervicb
authored andcommitted
fix test
1 parent 439802e commit d89bd75

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/e2e/app-router/e2e/middleware.rewrite.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ test("Middleware Rewrite External Image", async ({ page }) => {
3535

3636
test("Middleware Rewrite Status Code", async ({ page }) => {
3737
page.on("response", async (response) => {
38-
expect(response.status()).toBe(403);
38+
// Need to set up the event before navigating to the page to avoid missing it
39+
// We need to check the URL here also cause there will be multiple responses (i.e the fonts, css, js, etc)
40+
if (response.url() === "/rewrite-status-code") {
41+
expect(response.status()).toBe(403);
42+
}
3943
});
4044
await page.goto("/rewrite-status-code");
4145
const el = page.getByText("Rewritten Destination", { exact: true });

0 commit comments

Comments
 (0)