Add first-class HTTP QUERY method (RFC 10008)#896
Merged
Conversation
QUERY is safe and idempotent and carries a request body like POST. Generate hackney:query/1..4 from the method template, add the explicit h3 method mapping, and document the method in the README and HTTP guide. Tests cover h1, h2, and h3 against local servers that echo the wire method, including a local in-process quic_h3 server. Bump to 4.5.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
QUERY (RFC 10008) is a safe, idempotent method that carries a request body, intended for read-only operations too large or sensitive for a URL. This adds it as a first-class method: hackney:query/1..4 are generated from the method template and delegate to hackney:request(query, ...), and hackney_h3 gets an explicit QUERY mapping alongside the other methods. No other logic was needed since hackney has no method whitelist and body handling is method-agnostic, so every body mode (binary, streamed, async, connection API) works unchanged and the wire method is always QUERY with no fallback to POST.
Tests in test/hackney_query_tests.erl assert the wire method against local servers on all three protocols: cowboy for HTTP/1.1 (helper arities, generic request, JSON body, streamed body, async, connection API), a local h2 TLS server echoing the received :method, and a local in-process quic_h3 server that only answers 200 to QUERY, covering both hackney_h3:request and the full hackney:request stack over HTTP/3. README and the HTTP guide document the method, and the version moves to 4.5.0 with a NEWS entry.