Skip to content

Commit a3b374d

Browse files
committed
add another test for internal next headers
1 parent 1b6eba2 commit a3b374d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

packages/tests-e2e/tests/appRouter/middleware.cookies.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,24 @@ test.describe("Middleware Cookies", () => {
2121

2222
expect(await page.getByTestId("foo").textContent()).toBe("bar");
2323
});
24+
test("should not expose internal Next headers in response", async ({
25+
page,
26+
context,
27+
}) => {
28+
const responsePromise = page.waitForResponse((response) =>
29+
response.url().includes("/cookies"),
30+
);
31+
32+
await page.goto("/cookies");
33+
34+
const response = await responsePromise;
35+
const headers = response.headers();
36+
37+
const cookies = await context.cookies();
38+
const fooCookie = cookies.find(({ name }) => name === "foo");
39+
expect(fooCookie?.value).toBe("bar");
40+
41+
expect(headers).not.toHaveProperty("x-middleware-set-cookie");
42+
expect(headers).not.toHaveProperty("x-middleware-next");
43+
});
2444
});

0 commit comments

Comments
 (0)