mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #1048] [MERGED] fix(server): reject invalid HTTP methods with 400 in app route handlers #1046
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#1046
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/1048
Author: @NathanDrake2406
Created: 5/4/2026
Status: ✅ Merged
Merged: 5/4/2026
Merged by: @james-elicx
Base:
main← Head:fix/http-method-validation📝 Commits (1)
82fa445fix(server): reject invalid HTTP methods with 400 in app route handlers📊 Changes
3 files changed (+74 additions, -1 deletions)
View changed files
📝
packages/vinext/src/server/app-route-handler-dispatch.ts(+12 -1)📝
packages/vinext/src/server/app-route-handler-runtime.ts(+11 -0)📝
tests/app-route-handler-dispatch.test.ts(+51 -0)📄 Description
Summary
Vinext previously uppercased the request method and fell through to the normal 405 response for any unrecognized method. Next.js rejects non-standard methods with 400 Bad Request before dispatch.
Changes
isValidHTTPMethod()predicate toapp-route-handler-runtime.ts, co-located with the existingROUTE_HANDLER_HTTP_METHODSconstant.dispatchAppRouteHandler()before any auto-OPTIONS or 405 logic, matching Next.js behavior.HEADER=> 400.Next.js source reference
packages/next/src/server/route-modules/app-route/module.ts#L390-L392test/e2e/app-dir/app-routes/app-custom-routes.test.ts#L531-L538packages/next/src/server/web/http.tsVerification
vp test run tests/app-route-handler-dispatch.test.ts tests/app-route-handler-policy.test.ts tests/app-route-handler-runtime.test.ts— 25/25 passingvp test run tests/app-router.test.ts -t "route handler"— 28/28 passing🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.