Skip to content

✨ Add query and queryUri for the HTTP QUERY method (RFC 10008)#2557

Merged
AlexV525 merged 3 commits into
cfug:mainfrom
CaiJingLong:feat/2548-query-method
Jul 14, 2026
Merged

✨ Add query and queryUri for the HTTP QUERY method (RFC 10008)#2557
AlexV525 merged 3 commits into
cfug:mainfrom
CaiJingLong:feat/2548-query-method

Conversation

@CaiJingLong

@CaiJingLong CaiJingLong commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add Dio.query and Dio.queryUri convenience methods for the HTTP QUERY method defined in RFC 10008.
  • The QUERY method is safe and idempotent like GET, but allows a request body, which is useful for complex queries whose parameters are too large or too structured to fit in the request URI.
  • This is a purely additive change: the new methods follow the same pattern as the existing get/post/put/patch/delete/head convenience methods and delegate to request/requestUri with checkOptions('QUERY', options). No existing public API is changed, and all adapters already pass the method string through (HttpClient.openUrl on native, XMLHttpRequest.open on Web), so no adapter changes are required.
  • Updated CHANGELOG.md, README.md, and README-ZH.md.

Closes #2548

Verification

  • melos run format — pass
  • melos run analyze — pass
  • dart test test/test_suite_test.dart (dio, VM) — the two new QUERY tests pass, along with the rest of the HTTP method group. A few pre-existing failures in basic_tests and timeout_tests are environment-specific (DNS resolution / TLS handshake / download throughput on the local machine) and unrelated to this change.

AI attribution

Implementation, tests, and docs by Devin (GLM-5.2).

Generated with Devin

The QUERY method is safe and idempotent like GET, but allows a request
body, which is useful for complex queries that do not fit in the URL.

Closes cfug#2548

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@CaiJingLong
CaiJingLong requested a review from a team as a code owner July 13, 2026 07:55
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@AlexV525

Copy link
Copy Markdown
Member

The PR title and description cite RFC 9239, but that RFC is actually Updates to ECMAScript Media Types (defining text/javascript etc.) — unrelated to the HTTP QUERY method.

The correct reference is RFC 10008, published 2026-06-15 on the IETF Standards Track (Proposed Standard). The code, CHANGELOG, and README in this PR already cite 10008 correctly — only the PR title and description need to be updated to match.

FYI: Proposed Standard is the first formal stage of the IETF standards process (the same status HTTP/2 RFC 7540 and HTTP/3 RFC 9114 had at initial publication), not an Internet-Draft — so the adaptation itself is legitimate.

@CaiJingLong CaiJingLong changed the title ✨ Add query and queryUri for the HTTP QUERY method (RFC 9239) ✨ Add query and queryUri for the HTTP QUERY method (RFC 10008) Jul 14, 2026
@CaiJingLong

Copy link
Copy Markdown
Contributor Author

Thanks for the catch, @AlexV525. The PR title and description have been updated to reference RFC 10008 instead of RFC 9239. The code, CHANGELOG.md, README.md, and README-ZH.md already cited RFC 10008 correctly (fixed in c3e7a18), so no further code changes were needed.

Comment thread dio/lib/src/dio.dart Outdated
Comment on lines +183 to +189
///
/// The QUERY method is defined in [RFC 10008][]. Unlike GET, it allows a
/// request body, and unlike POST, it is safe and idempotent. It is intended
/// for complex queries whose parameters are too large or too structured to
/// fit in the request URI.
///
/// [RFC 10008]: https://www.rfc-editor.org/rfc/rfc10008

@AlexV525 AlexV525 Jul 14, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method doesn't need this full comment because we also enable the request payload for GET in dio. Align with others. The same goes for queryUri.

Per review feedback, the QUERY method does not need a full description
here since dio also enables request payloads for GET. Trim the comments
to match the single-line style used by `get`/`post`/`put`/etc.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@CaiJingLong

Copy link
Copy Markdown
Contributor Author

Done. The doc comments on query and queryUri are trimmed to a single line each, matching the style of get/post/put/patch/delete/head. See ee8a0fa.

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage Report: Only Changed Files listed

Package Base Coverage New Coverage Difference
dio/lib/src/dio_mixin.dart 🟢 94.12% 🟢 94.25% 🟢 0.13%
Overall Coverage 🟢 85.68% 🟢 85.72% 🟢 0.04%

Minimum allowed coverage is 0%, this run produced 85.72%

@AlexV525
AlexV525 merged commit 1357615 into cfug:main Jul 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for the new "QUERY" method

2 participants