Skip to content

Add support for the HTTP QUERY method (RFC 10008)#1319

Merged
josevalim merged 1 commit into
elixir-plug:mainfrom
psolvy:add-query-method
Jun 25, 2026
Merged

Add support for the HTTP QUERY method (RFC 10008)#1319
josevalim merged 1 commit into
elixir-plug:mainfrom
psolvy:add-query-method

Conversation

@psolvy

@psolvy psolvy commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds first-class 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 like POST — the request content (of any media type) defines the query. Because it is idempotent, a QUERY can be safely retried, unlike POST.

Changes

  • Plug.Router — add a query/3 convenience macro, mirroring get/3, post/3, etc. (Routing arbitrary verbs already worked via match/:via; this adds the ergonomic, discoverable verb macro.)
  • Plug.Parsers — add QUERY to the methods whose body is parsed (previously POST, PUT, PATCH, DELETE). This is the substantive change: a QUERY's body is its defining feature, so it now populates conn.body_params / conn.params just like POST.
  • Plug.CSRFProtection — treat QUERY as an unprotected method alongside HEAD, GET, OPTIONS. QUERY is safe and cannot change state, so it does not require CSRF token verification; without this, QUERY routes behind a session/CSRF pipeline would be rejected.

References

…uting, enable body parsing, and treat QUERY as unprotected in CSRF protection.
@josevalim josevalim merged commit 82cbff6 into elixir-plug:main Jun 25, 2026
2 checks passed
@josevalim

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

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

Labels

None yet

2 participants