Skip to content

Add support for the QUERY HTTP method#3370

Open
Kfir-G wants to merge 2 commits into
Kludex:mainfrom
Kfir-G:support-query-metho
Open

Add support for the QUERY HTTP method#3370
Kfir-G wants to merge 2 commits into
Kludex:mainfrom
Kfir-G:support-query-metho

Conversation

@Kfir-G

@Kfir-G Kfir-G commented Jul 6, 2026

Copy link
Copy Markdown

Summary

Adds support for the QUERY HTTP method (draft spec: https://http.dev/query). Follow-up to the discussion here: [link to your discussion].

Routing itself already worked with no changes, since Route/Router don't hardcode a fixed list of HTTP verbs - Route("/search", search, methods=["QUERY"]) already works today. The actual changes needed were small:

  • starlette/endpoints.py - added "QUERY" to the verbs HTTPEndpoint checks when building _allowed_methods, so a .query() handler on a class-based endpoint is recognized (and shows up correctly in the Allow header on 405 responses).
  • starlette/schemas.py - added "query" to the method list SchemaGenerator checks on class-based endpoints, so .query() handlers are picked up in generated OpenAPI schemas.
  • docs/routing.md and docs/endpoints.md - short additions showing QUERY as a supported method.

This is purely additive - QUERY is only reachable if a route explicitly opts in via methods=[...], same as any other verb, so it shouldn't interact with the recent HTTPEndpoint dispatch advisory (GHSA-x746-7m8f-x49c).

Ran scripts/check and scripts/test locally - all passing, 100% coverage maintained.

This is my first PR here, so happy to adjust based on feedback or conventions I'm missing.

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 7 files

Re-trigger cubic

@marcp54

marcp54 commented Jul 15, 2026

Copy link
Copy Markdown

TestClient needs a query function that follows the same pattern as the other methods and inherits from Httpx2 Client which support for query was added a day ago.

However the issue, starlette's pyproject.toml restricts uv new builds up to 7 days.

exclude-newer = "7 days"

I don't think the maintainers will want to reduce the restriction so this might sit for a few days until that window expires.

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.

2 participants