The IETF recently published RFC 10008, which formally introduces the HTTP QUERY method.
Basically, it fixes the old problem where GET URLs get too long for complex search filters or GraphQL, and using POST breaks idempotency and HTTP-level caching. QUERY is simply a safe and idempotent method that carries a request body.
I suggest we implement native support for this in CakePHP 5.
Proposed approach
It shouldn't require a massive rewrite. The most logical places to update would be:
- Routing: Ensure the router correctly accepts
QUERY as a valid method. We could add a $builder->query() shorthand in Cake\Routing\RouteBuilder alongside get(), post(), etc.
- Request Handling:
ServerRequest::is('query') should return true. The body parser needs to process QUERY payloads exactly as it already does for POST or PUT requests.
- HTTP Client: Add a
$client->query() convenience method to Cake\Http\Client so developers can easily make outbound QUERY requests.
CakePHP Version
5.0 >
The IETF recently published RFC 10008, which formally introduces the HTTP
QUERYmethod.Basically, it fixes the old problem where
GETURLs get too long for complex search filters or GraphQL, and usingPOSTbreaks idempotency and HTTP-level caching.QUERYis simply a safe and idempotent method that carries a request body.I suggest we implement native support for this in CakePHP 5.
Proposed approach
It shouldn't require a massive rewrite. The most logical places to update would be:
QUERYas a valid method. We could add a$builder->query()shorthand inCake\Routing\RouteBuilderalongsideget(),post(), etc.ServerRequest::is('query')should return true. The body parser needs to processQUERYpayloads exactly as it already does forPOSTorPUTrequests.$client->query()convenience method toCake\Http\Clientso developers can easily make outboundQUERYrequests.CakePHP Version
5.0 >