[PR #497] [MERGED] fix(route-handlers): align Allow and default-export behavior with Next.js #619

Closed
opened 2026-05-06 13:09:07 +02:00 by BreizhHardware · 0 comments

📋 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: mainHead: fix/route-handler-allow-header


📝 Commits (7)

  • 8fcf523 fix: ensure route handlers send correct Allow header
  • 7fa5581 Merge branch 'main' into fix/route-handler-allow-header
  • 3c10c7f Inline route handler Allow helpers in RSC entry
  • ea46baa Merge branch 'fix/route-handler-allow-header' of https://github.com/Dayifour/vinext into fix/route-handler-allow-header
  • 5e970ca fix: refresh entry snapshots and fmt
  • e1dda42 fix(route-handlers): align Allow and default-export behavior with Next.js
  • c50698b fix(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.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/497 **Author:** [@Dayifour](https://github.com/Dayifour) **Created:** 3/12/2026 **Status:** ✅ Merged **Merged:** 3/13/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/route-handler-allow-header` --- ### 📝 Commits (7) - [`8fcf523`](https://github.com/cloudflare/vinext/commit/8fcf5233965136c5eea85f94ecf001f5734faf6a) fix: ensure route handlers send correct Allow header - [`7fa5581`](https://github.com/cloudflare/vinext/commit/7fa5581610ebe8cb9bbfc556994b828af5e8dc8e) Merge branch 'main' into fix/route-handler-allow-header - [`3c10c7f`](https://github.com/cloudflare/vinext/commit/3c10c7fad9a944e263125a6d56ba23f20426f24d) Inline route handler Allow helpers in RSC entry - [`ea46baa`](https://github.com/cloudflare/vinext/commit/ea46baaf19996d5d6d7b2a96376c164d3a94bd99) Merge branch 'fix/route-handler-allow-header' of https://github.com/Dayifour/vinext into fix/route-handler-allow-header - [`5e970ca`](https://github.com/cloudflare/vinext/commit/5e970ca7d57d3565d04eaafd0278f2c930eeea3a) fix: refresh entry snapshots and fmt - [`e1dda42`](https://github.com/cloudflare/vinext/commit/e1dda4246e3a94fb43f0a71f4cedcf733faa96ae) fix(route-handlers): align Allow and default-export behavior with Next.js - [`c50698b`](https://github.com/cloudflare/vinext/commit/c50698b941061898ea4a8c317a3c4242b5c4eaa7) fix(route-handlers): align default-export behavior with Next.js per review ### 📊 Changes **8 files changed** (+249 additions, -140 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 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.` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:09:07 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#619
No description provided.