Skip to content

Add query() route shortcut and MethodView support for HTTP QUERY#6064

Closed
aliunsal wants to merge 3 commits into
pallets:mainfrom
aliunsal:main
Closed

Add query() route shortcut and MethodView support for HTTP QUERY#6064
aliunsal wants to merge 3 commits into
pallets:mainfrom
aliunsal:main

Conversation

@aliunsal

@aliunsal aliunsal commented Jun 23, 2026

Copy link
Copy Markdown

Description

RFC 10008 (June 2026) standardizes
the QUERY HTTP method: a safe, idempotent request method that carries content
in the request body (standardizing the "POST for a read-only query with a large
body" workaround used by GraphQL and REST search endpoints).

Flask already routes and dispatches arbitrary method names, so this adds the
idiomatic ergonomics that mirror the existing
get/post/put/delete/patch shortcuts:

  • Scaffold.query() registers a route with methods=["QUERY"], inherited by
    both Flask and Blueprint.
  • "query" is added to views.http_method_funcs, so MethodView dispatches a
    QUERY request to a query handler.

Higher-level RFC 10008 features (the Accept-Query header, server-assigned
query-result URIs, caching semantics) are application/Werkzeug concerns and are
intentionally out of scope.

Related

fixes #6065

Checklist

  • Tests added that fail without the change (test_query_method_route,
    test_query_method_view).
  • Code docs updated (query() docstring with .. versionadded:: 3.2); the
    method is surfaced via the Flask/Blueprint autoclass, so no manual
    docs/ change is needed.
  • CHANGES.rst entry added, linking to the issue.
  • .. versionadded:: added (new method, so versionadded rather than
    versionchanged).

Note: tests use client.open(method="QUERY") rather than client.query() so
they pass against the released Werkzeug. A Client.query() shortcut is a
separate, independent Werkzeug change (pallets/werkzeug#3194).

aliunsal added 3 commits June 23, 2026 17:26
RFC 10008 (June 2026) standardizes the QUERY HTTP method: a safe,
idempotent request method that carries content in the request body.
Flask already routes and dispatches arbitrary methods, so this adds the
idiomatic ergonomics that mirror the existing get/post/put/delete/patch
shortcuts:

- Scaffold.query() registers a route with methods=["QUERY"], inherited by
  both Flask and Blueprint.
- "query" is added to views.http_method_funcs so MethodView dispatches a
  QUERY request to a `query` handler.

Includes tests, a changelog entry, and an autodoc-picked docstring.
Add query() route shortcut and MethodView support for HTTP QUERY
@aliunsal aliunsal closed this Jun 24, 2026
@aliunsal

Copy link
Copy Markdown
Author

Superseded by #6066, which opens the same change from a topic branch (feat/http-query-method) instead of main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a query() route shortcut and MethodView support for HTTP QUERY (RFC 10008)

1 participant