Add support for the HTTP QUERY method (RFC 10008) - #6737
Conversation
|
I assume we need to wait for an updated plug and then bump the minimum plug version? |
|
@SteffenDE hello! UPD updated this one with a minimum Plug version and bumped phoenix minor version instead of fix one |
|
@psolvy please update again, we moved main to 1.9 now, so the changelog has a conflict :) @josevalim current Plug still allows Elixir 1.15, so if we want to backport, do you see a reason we can't require plug 1.21 for Phoenix 1.8? |
|
@SteffenDE done! PS as i can see query changes are in the |
|
Perfect, thank you. Yes, Plug 1.21 is not out yet. |
- elixir_plug: add `query/2` (elixir-plug/plug#1319) to the standard route-macro table, gated by the existing leading-`/` guard, and teach `match "/path", via: :query` (a single atom, not just a bracketed list) to `line_to_endpoint`. - elixir_phoenix: `match :query, ...` already routes today since a Phoenix router sits on Plug — no code change needed there. Leave Phoenix's own `query` router macro out of `STANDARD_ROUTE_METHODS` until phoenixframework/phoenix#6737 ships; that table's regex has no path-must-start-with-`/` guard, so adding a bare `query` verb ahead of upstream would misread unrelated `query("x", CapitalizedMod)` helpers (a common Ecto/dispatch-helper shape) as routes. - Add fixture coverage for the Phoenix `match :query` shape and the Plug `query`/`via: :query` shapes, including one inside a Phoenix scope/pipeline. Closes #2558
|
@SteffenDE any opportunity to get this one to hex? |
|
As per above, it needs a new plug release and even then I recommend using Phoenix main as this will be part of 1.9 which won’t be out immediately |
Summary
Adds support for the new HTTP QUERY method, standardized in RFC 10008 (Proposed Standard, June 2026).
QUERY is safe and idempotent like
GET, but carries a request body likePOST— the request content (of any media type) defines the query. Because it is idempotent, a QUERY can be safely retried, unlikePOST.Changes
Phoenix.Router— add:queryto the supported HTTP verbs, generating thequery/3andquery/4route macros (mirroringget,post, etc.). Routing arbitrary verbs already worked viamatch; this adds the ergonomic, discoverable verb macro.Phoenix.ConnTest— add the matchingquery/3test helper, for parity with the other verbs.guides/routing.md— document QUERY among the supported HTTP verbs.mix.exs— raise the minimum Plug requirement to~> 1.21, the release that parses QUERY request bodies intoconn.body_paramsand treats QUERY as a safe method inPlug.CSRFProtection(Add support for the HTTP QUERY method (RFC 10008) elixir-plug/plug#1319). Because this raises a dependency floor and adds a new public macro, the CHANGELOG targets a 1.9.0 (minor) release.References