Repository navigation
Replies: 2 comments
|
Great proposal! With RFC 10008 officially standardizing the HTTP Here is a breakdown of the implementation surface in 1. Concrete Codebase Touchpoints in Next.jsTo land
2. Caching: Should it be in Phase 1 or Separated?Recommendation: Decouple caching and ship Phase 1 with Here is why:
By keeping Phase 1 scoped to execution and dispatching only (treating 3. Middleware & Edge Runtime InteroperabilityOne key thing to verify in the implementation is the
Looking forward to seeing this PR land upstream! |
|
This is already being worked on here: #97561 |
Uh oh!
There was an error while loading. Please reload this page.
Goals
Non-Goals
Background
The HTTP QUERY method is designed to retrieve resources using request content, providing an alternative when complex query parameters become difficult to represent in a URL.
In many applications, search and filtering operations require structured criteria, nested filters, or large request parameters.
GET remains the standard choice for retrieval, but its request target is limited in practical size and does not provide a request body mechanism with standardized semantics.
POST is commonly used as an alternative for complex searches, but it does not have the same default safety and idempotency semantics as QUERY.
The QUERY method is standardized in RFC 10008 and provides a dedicated HTTP method for these use cases.
Currently, Next.js App Router Route Handlers do not expose QUERY as a supported named export. Developers therefore cannot handle it through the standard route.ts interface.
Adding support would allow Next.js applications to use this HTTP method without relying on custom servers or external routing layers.
Proposal
I propose extending the existing App Router Route Handler implementation to recognize QUERY as a supported HTTP method.
The expected API would follow the existing Route Handler conventions:
Example request:
The implementation would need to cover:
Adding QUERY to the supported HTTP methods.
Updating Route Handler method resolution and dispatching.
Updating build-time validation and TypeScript route handler definitions.
Ensuring request bodies are accessible through the standard Request API.
Verifying compatibility with dynamic routes and middleware/proxy.
Investigating caching behavior in accordance with QUERY semantics and the relevant HTTP caching rules.
I am interested in contributing to this feature and implementing the required changes, including tests, if the proposal is considered suitable for the Next.js architecture.
I would also appreciate feedback on whether caching support should be included in the initial implementation or addressed separately.
All reactions