3 Commits

Author SHA1 Message Date
James Anderson 0fbbe33a2e fix: pass params: null (not {}) for non-dynamic routes (#1374)
Next.js exposes `params` as `null` (effectively — via `params || null`
or `params ? await params : null` user-side) to route handlers and
`getServerSideProps`/`getStaticProps` on routes with no dynamic
segments. vinext was passing an empty object, which is truthy and
breaks user code that branches on `params`.

The fix computes a user-facing params value at each dispatch boundary
(`null` when `route.isDynamic === false`, otherwise the matched
object) while leaving internal bookkeeping — navigation context, query
merging, `useParams()` — on the empty-object shape that those
consumers expect.

References the Next.js test suite assertions:
- test/e2e/app-dir/app-routes/app-custom-routes.test.ts
  "does not provide params to routes without dynamic parameters"
- test/e2e/edge-pages-support/index.test.ts
  "should have correct query/params on index"

Closes #1350
2026-05-21 11:27:07 +01:00
Nathan Nguyen 390b4608be fix(server): reject invalid HTTP methods with 400 in app route handlers (#1048)
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 before dispatch.

- Add isValidHTTPMethod() predicate to app-route-handler-runtime.ts

- Return empty 400 in dispatchAppRouteHandler() before auto-OPTIONS/405

- Port Next.js test: HEADER => 400 Bad Request

Next.js source reference:

https://github.com/vercel/next.js/blob/canary/packages/next/src/server/route-modules/app-route/module.ts#L390-L392

https://github.com/vercel/next.js/blob/canary/test/e2e/app-dir/app-routes/app-custom-routes.test.ts#L531-L538
2026-05-04 18:56:23 +01:00
Nathan Nguyen 78edbc3b46 refactor: Extract app route handler dispatch (#968) 2026-04-29 21:05:38 +01:00