Skip to content

feat: add QUERY method routing - #3801

Merged
mladedav merged 5 commits into
tokio-rs:mainfrom
yunz-dev:main
Aug 3, 2026
Merged

feat: add QUERY method routing#3801
mladedav merged 5 commits into
tokio-rs:mainfrom
yunz-dev:main

Conversation

@yunz-dev

@yunz-dev yunz-dev commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Add MethodFilter::QUERY, routing::query[_service] and MethodRouter::query[_service] and RouterExt::typed_query

Motivation

Recently the RFC 10008 standardized the HTTP QUERY method, which is also registered at the IANA HTTP Method Registry. In short, this new method is a mix of GET and POST method: it's safe and idempotent like GET but also has a body like POST.

Solution

It's already supported in http (hyperium/http#798) but I don't think that it's been released yet, so you can develop against the git version or wait for a release. #3799 (comment)

While developing I put this in the root Config.toml

[patch.crates-io]
http = { git = "https://github.com/hyperium/http.git" }

yunz-dev added 2 commits June 18, 2026 00:00
Add `MethodFilter::QUERY`, `routing::query[_service]` and `MethodRouter::query[_service]`
@yunz-dev

Copy link
Copy Markdown
Contributor Author

CI will fail until hyperium/http#798 in release

pub const TRACE: Self = Self::from_bits(0b1_0000_0000);
pub const TRACE: Self = Self::from_bits(0b01_0000_0000);
/// Match `QUERY` requests.
pub const QUERY: Self = Self::from_bits(0b10_0000_0000);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unsure if the bit mask is meant to follow a certain protocol or it doesn’t matter.

@aabolfazl

Copy link
Copy Markdown

I'like to add more sections of RFC if not implemented yet.

Samielakkad

This comment was marked as outdated.

@mladedav

This comment has been minimized.

@yunz-dev

yunz-dev commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Seems like http v1.5.0 is released, I'll fix this up when I get home.

@yunz-dev
yunz-dev force-pushed the main branch 2 times, most recently from 28bc7b0 to dcab719 Compare August 1, 2026 12:56
@mladedav

mladedav commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

It's not enough to update cargo.lock, you have to bump the version in cargo.toml too since this is a new .minimum version we require to compile.

That's why the msrv check fails, which actually also checks minimum dependency versions.

@yunz-dev

yunz-dev commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

It's not enough to update cargo.lock, you have to bump the version in cargo.toml too since this is a new .minimum version we require to compile.

ahh.. right. Silly me haha. Should be fixed now

@mladedav mladedav left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

@mladedav
mladedav merged commit a2e64a8 into tokio-rs:main Aug 3, 2026
17 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 HTTP QUERY Method

5 participants