mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #446] [MERGED] fix: Pages API body parser for invalid JSON and repeated form keys #576
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#576
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/446
Author: @JaredStowell
Created: 3/11/2026
Status: ✅ Merged
Merged: 3/11/2026
Merged by: @james-elicx
Base:
main← Head:jstowell/fix-pages-api-body-parser-parity📝 Commits (6)
8d8cebaFix Pages API parsing parity4142041Fix Pages API body parsing parityaf293f9Fix empty form body parity3664c89Merge main into jstowell/fix-pages-api-body-parser-parityb7d7c5fRegenerate entry-templates snapshots after mergea7852c6fix: propagate statusText through prod server sendCompressed non-compressed path📊 Changes
8 files changed (+397 additions, -54 deletions)
View changed files
📝
packages/vinext/src/entries/pages-server-entry.ts(+21 -6)📝
packages/vinext/src/server/api-handler.ts(+19 -4)📝
packages/vinext/src/server/prod-server.ts(+36 -7)📝
tests/__snapshots__/entry-templates.test.ts.snap(+27 -10)📝
tests/api-handler.test.ts(+57 -6)📝
tests/fixtures/pages-basic/middleware.ts(+1 -1)➕
tests/fixtures/pages-basic/pages/api/parse.ts(+5 -0)📝
tests/pages-router.test.ts(+231 -20)📄 Description
Bring Pages API body parsing in line with Next.js for JSON and urlencoded requests.
Changes
400 Invalid JSONfor malformedapplication/jsonrequests instead of passing raw strings to handlersapplication/x-www-form-urlencodedkeys as arrays viaquerystring.decode(){}to match Next.js behaviorapplication/ld+jsonas JSONstatusTextthrough the Pages production server pathTesting
pnpm test tests/api-handler.test.ts tests/pages-router.test.ts tests/entry-templates.test.ts -upnpm test tests/features.test.ts -t "production server compression"pnpm run fmtpnpm run typecheck🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.