Skip to content

Support for HTTP QUERY method #19535

Description

@zunnu

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:

  1. 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.
  2. 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.
  3. HTTP Client: Add a $client->query() convenience method to Cake\Http\Client so developers can easily make outbound QUERY requests.

CakePHP Version

5.0 >

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions