[13.x] Add Http::query() method to the HTTP client#60663
Open
shanerbaner82 wants to merge 1 commit into
Open
Conversation
Adds a query() method to the HTTP client, issuing requests using the HTTP QUERY method (RFC 10008) with the data carried in the request body, mirroring the existing post/put/patch/delete helpers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Concept first mentioned by issue #60564, in case we want extra discussion. |
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.
The HTTP
QUERYmethod was recently published as RFC 10008 on the IETF Standards Track: a safe, cacheable method that carries its query in the request body, enabling expressive queries without the URL-length and cacheability trade-offs of GET vs. POST.Support for QUERY is landing across the ecosystem — Symfony chose its HTTP client as the first component to support it — and it is arriving in Laravel via #60655 (routing,
master) and #60662 (testing helpers,13.x). This PR completes the story for the consuming side: Laravel's HTTP client has a method per verb (get,head,post,put,patch,delete) but no way to issue a QUERY request without dropping down toHttp::send('QUERY', ...).The method mirrors
post()exactly: data is sent in the request body using the pending request's body format (JSON by default, form-urlencoded viaasForm(), etc.), which matches RFC 10008's body-carried query semantics.withQueryParameters()and the$queryargument toget()are unaffected and continue to control the query string.Fully backward compatible — purely additive, no contracts changed, and
PendingRequesthad no existingquery()method. Tests cover the default JSON body format andasForm(), asserting the method and body placement throughHttp::fake().Related: #60655, #60662, discussion #60564
🤖 Generated with Claude Code