mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #281] [MERGED] fix: apply headers, cookies, and status set by getServerSideProps to the response #440
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#440
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/281
Author: @southpolesteve
Created: 3/6/2026
Status: ✅ Merged
Merged: 3/6/2026
Merged by: @southpolesteve
Base:
main← Head:fix/render-page-response-headers📝 Commits (2)
85273a0fix: apply headers, cookies, and status set by getServerSideProps to the response599b5efrefactor: explicitly forward gSSP headers in dev server📊 Changes
5 files changed (+155 additions, -11 deletions)
View changed files
📝
packages/vinext/src/index.ts(+37 -6)📝
packages/vinext/src/server/dev-server.ts(+54 -5)➕
tests/fixtures/pages-basic/pages/ssr-headers.tsx(+26 -0)➕
tests/fixtures/pages-basic/pages/ssr-res-end.tsx(+16 -0)📝
tests/pages-router.test.ts(+22 -0)📄 Description
Summary
getServerSidePropsreceives aresobject that supportssetHeader(),statusCode, andend(). Previously, headers/cookies/status set on this object were silently discarded in the final HTML response.renderPageinindex.ts): the mockresobject's accumulated state is now merged into the finalResponse, including custom headers, Set-Cookie values, and non-200 status codesdev-server.ts):res.statusCodeset by gSSP is now preserved throughstreamPageToResponse, andres.end()short-circuit is detected to avoid writing to an already-ended streamgetHeaders()andheadersSentto the mockresobject increateReqResso callers can read accumulated response metadatares.end()short-circuit behaviorTest plan
Two new fixture pages:
pages/ssr-headers.tsx— gSSP setsx-custom-header, aSet-Cookie, andstatusCode = 201pages/ssr-res-end.tsx— gSSP callsres.end()with a JSON body and status 202Two new integration tests in
pages-router.test.tsverify headers, cookies, status, and short-circuit behavior.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.