{{ message }}
feat: add support for the QUERY HTTP method#10579
Open
mahmoodhamdi wants to merge 1 commit intoaxios:v1.xfrom
Open
feat: add support for the QUERY HTTP method#10579mahmoodhamdi wants to merge 1 commit intoaxios:v1.xfrom
mahmoodhamdi wants to merge 1 commit intoaxios:v1.xfrom
Conversation
Add axios.query() and axios.queryForm() as shorthand methods for the QUERY HTTP method (RFC draft-ietf-httpbis-safe-method-w-body). QUERY is a safe, idempotent method like GET but allows a request body, making it ideal for complex queries that don't fit in URL parameters. Changes: - Add query to the methods-with-data alias group (like post/put/patch) - Add query to default headers initialization - Add query to the headers flattening list - Add query to the content-type dispatch list - Update TypeScript declarations (both ESM and CJS) - Add tests for query/queryForm with body, content-type, and form data Closes axios#5465
Contributor
There was a problem hiding this comment.
1 issue found across 7 files
Confidence score: 3/5
- There is a concrete regression risk in
index.d.cts:HeadersDefaultsis missingquery, which creates a type/runtime mismatch for the new QUERY default headers. - Because this is a medium-severity (6/10), high-confidence (9/10) issue in shared type definitions, it can impact consumers at compile time and lead to confusing behavior versus runtime defaults.
- This should be straightforward to fix, but it is worth addressing before merge to keep typings aligned with actual header behavior.
- Pay close attention to
index.d.cts- ensureHeadersDefaultsincludesqueryso declared types match runtime QUERY defaults.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="index.d.cts">
<violation number="1" location="index.d.cts:378">
P2: `HeadersDefaults` is missing `query`, causing a type/runtime mismatch for newly added QUERY default headers.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Contributor
There was a problem hiding this comment.
P2: HeadersDefaults is missing query, causing a type/runtime mismatch for newly added QUERY default headers.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At index.d.cts, line 378:
<comment>`HeadersDefaults` is missing `query`, causing a type/runtime mismatch for newly added QUERY default headers.</comment>
<file context>
@@ -364,7 +374,9 @@ declare namespace axios {
| 'unlink'
- | 'UNLINK';
+ | 'UNLINK'
+ | 'query'
+ | 'QUERY';
</file context>
Member
There was a problem hiding this comment.
@mahmoodhamdi, can you please check this? We would need to fix this issue as it is valid.
jasonsaayman
requested changes
Apr 4, 2026
Member
jasonsaayman
left a comment
There was a problem hiding this comment.
Please fix the cubic issue raised. This is a valid concern.
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.

Summary
Adds
axios.query()andaxios.queryForm()as shorthand methods for the QUERY HTTP method (RFC draft-ietf-httpbis-safe-method-w-body).QUERY is a safe, idempotent method like GET but allows a request body — ideal for complex queries that don't fit in URL parameters.
Usage
Changes
lib/core/Axios.jsqueryto methods-with-data aliases (generatesquery+queryForm) and headers flattening listlib/core/dispatchRequest.jsqueryto content-type dispatch listlib/defaults/index.jsqueryto default headers initializationindex.d.tsquery/QUERYtoMethodtype, addquery()/queryForm()toAxiosclassindex.d.ctstests/unit/api.test.jsqueryandqueryFormto method existence checkstests/unit/core/query-method.test.jsTesting
axios.query()sends QUERY request with JSON bodyaxios.queryForm()sends QUERY request with multipart/form-dataaxios({ method: 'query' })generic syntax worksCloses #5465
Summary by cubic
Adds support for the QUERY HTTP method to
axiosviaaxios.query()andaxios.queryForm(). Enables safe, idempotent requests with a body for complex queries.Description
queryto methods-with-data; generatesquery/queryFormon static and instance APIs.queryin headers flattening, defaults init, and content-type handling.index.d.tsandindex.d.ctswith'query' | 'QUERY'and new methods.axios({ method: 'query' }); no breaking changes.query/queryForm. Closes Add the QUERY HTTP method #5465.Testing
tests/unit/core/query-method.test.jsfor JSON body,queryFormmultipart, content-type defaults, and generic config path.tests/unit/api.test.jsto checkqueryandqueryFormexist on static and instance APIs.Written for commit 8ed320c. Summary will update on new commits.