Skip to content

test: adjust assertions to work with validateRSCRequestHeaders enabled #2985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
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
8 changes: 6 additions & 2 deletions tests/e2e/edge-middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,11 @@ test.describe('RSC cache poisoning', () => {
test('Middleware rewrite', async ({ page, middleware }) => {
const prefetchResponsePromise = new Promise<Response>((resolve) => {
page.on('response', (response) => {
if (response.url().includes('/test/rewrite-to-cached-page')) {
if (
(response.url().includes('/test/rewrite-to-cached-page') ||
response.url().includes('/caching-rewrite-target')) &&
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note - the redirect that happens due to validateRSCRequestHeaders ( https://github.com/vercel/next.js/blob/21ff892d05e43644ebfd990d03d7f1742f9c46a7/packages/next/src/server/base-server.ts#L2086-L2098 ) result in seeing redirect with location being rewrite target

response.status() === 200
) {
resolve(response)
}
})
Expand All @@ -400,7 +404,7 @@ test.describe('RSC cache poisoning', () => {
test('Middleware redirect', async ({ page, middleware }) => {
const prefetchResponsePromise = new Promise<Response>((resolve) => {
page.on('response', (response) => {
if (response.url().includes('/caching-redirect-target')) {
if (response.url().includes('/caching-redirect-target') && response.status() === 200) {
resolve(response)
}
})
Expand Down
Loading