feat(http): add http.query() convenience method for the HTTP QUERY method - #6481
Open
ashrafiucse wants to merge 1 commit into
Open
ashrafiucse wants to merge 1 commit into
ashrafiucse wants to merge 1 commit into
Conversation
ashrafiucse
requested review from
AgnesToulet and
janHildebrandt98
and removed request for
a team
September 21, 2026 20:23
Signed commits reportAll 1 commit between |
…thod
RFC 10008 standardized the HTTP QUERY method: a safe, idempotent method
that carries a request body, for cases where the query is too large,
complex, or sensitive to put in the URL.
k6 could already issue QUERY requests through http.request('QUERY', ...),
since the method string is passed through to net/http. This adds the
http.query(url, body, params) helper for parity with the existing
per-method wrappers (get/post/put/patch/del/options), so QUERY is
discoverable and consistent now that it's a real standard.
Fixes grafana#6128
ashrafiucse
force-pushed
the
add-http-query-method
branch
from
September 21, 2026 20:34
bc2e9d8 to
45d380d
Compare
This branch has not been deployed
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.
What?
Adds an
http.query(url, body, params)convenience method for the HTTP QUERY method, as suggested in #6128.QUERY (RFC 10008, Proposed Standard as of June 2026) is a safe, idempotent method that carries a request body — for queries too large, complex, or sensitive to put in the URL.
Why?
http.request('QUERY', url, body)already works since the method string passes through to net/http, but every other method has a discoverable helper (http.get,http.post,http.put,http.patch,http.del,http.options). This gives QUERY the same treatment.Implementation
js/modules/k6/http/http.go, mirroring the other body-carrying method helpers. net/http has noMethodQueryconstant, so it's defined locally.TestRequestcovering method, body, and headers round-trip through/anything.Testing
go test -race ./js/modules/k6/http/passes, including the newTestRequest/QUERYsubtest.Docs for the new method will need a follow-up in the docs repo.
Fixes #6128