mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 00:09:23 +02:00
[PR #497] [MERGED] fix(route-handlers): align Allow and default-export behavior with Next.js #619
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#619
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/497
Author: @Dayifour
Created: 3/12/2026
Status: ✅ Merged
Merged: 3/13/2026
Merged by: @james-elicx
Base:
main← Head:fix/route-handler-allow-header📝 Commits (7)
8fcf523fix: ensure route handlers send correct Allow header7fa5581Merge branch 'main' into fix/route-handler-allow-header3c10c7fInline route handler Allow helpers in RSC entryea46baaMerge branch 'fix/route-handler-allow-header' of https://github.com/Dayifour/vinext into fix/route-handler-allow-header5e970cafix: refresh entry snapshots and fmte1dda42fix(route-handlers): align Allow and default-export behavior with Next.jsc50698bfix(route-handlers): align default-export behavior with Next.js per review📊 Changes
8 files changed (+249 additions, -140 deletions)
View changed files
📝
CLAUDE.md(+1 -1)📝
packages/vinext/src/entries/app-rsc-entry.ts(+39 -17)📝
tests/__snapshots__/entry-templates.test.ts.snap(+162 -72)📝
tests/app-router.test.ts(+15 -18)📝
tests/e2e/app-router/api-routes.spec.ts(+11 -6)➕
tests/fixtures/app-basic/app/api/invalid-default/route.ts(+4 -0)📝
tests/fixtures/app-basic/app/api/methods/route.ts(+0 -10)📝
tests/nextjs-compat/TRACKING.md(+17 -16)📄 Description
Summary
Align route handler behavior with Next.js for HTTP method handling.
Keep implicit OPTIONS auto-response (204) and sort its Allow header deterministically.
Stop sending Allow on 405 Method Not Allowed responses (Next.js parity).
Reject default export in route handlers (only named HTTP method exports are valid).
Add a dedicated invalid fixture and update integration/e2e tests accordingly.
Refresh ON-3 tracking note and generated entry snapshots.
Testing
# Unit/Integration tests pnpm test tests/entry-templates.test.ts pnpm test app-router.test.ts -t "errors when a route handler exports a default function"# E2E tests (Windows/PowerShell syntax) $env:PLAYWRIGHT_PROJECT='app-router'; pnpm run test:e2e tests/e2e/app-router/api-routes.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.