Skip to content

feat: support the HTTP QUERY method (RFC 10008) - #1124

Open
lrweck wants to merge 1 commit into
danielgtaylor:mainfrom
lrweck:feat/query-method
Open

lrweck wants to merge 1 commit into
danielgtaylor:mainfrom
lrweck:feat/query-method

Conversation

@lrweck

@lrweck lrweck commented Sep 26, 2026

Copy link
Copy Markdown

Fixes #1123

Summary

Adds first-class support for the HTTP QUERY method (RFC 10008): a safe, idempotent method that carries a request body, sitting between GET and POST.

  • huma.Register no longer panics with unknown method QUERY; the operation is stored under PathItem.Query (OpenAPI 3.2).
  • New huma.Query convenience wrapper, mirroring huma.Get/Post/....
  • humatest gains Query/QueryCtx helpers for parity with the other verbs.
  • MethodQuery is defined in Huma (not http.MethodQuery) because the stdlib constant is only on Go master (CL 822384), not in any release. It is a plain "QUERY" string, so callers can keep using the raw literal too.

Known limitation: OpenAPI version

Huma emits openapi: 3.1.0, but the query path item is only defined in OpenAPI 3.2. The key is emitted whenever a QUERY operation exists; tools validating strictly against the 3.1 schema may reject or ignore it (and it also passes through Downgrade() to 3.0.3). Happy to gate it or bump the emitted version if you prefer a different trade-off — kept the change minimal here.

Notes

  • MethodQuery is a local constant because http.MethodQuery is not in a Go release yet (only on master, CL 822384). Once it ships, we can drop the local constant (and the raw "QUERY" literal) and use http.MethodQuery.
  • net/http already routes the raw method, so no stdlib change is required to use this.
  • Related Go follow-up: redirect semantics for QUERY (golang/go#80488).

Registering Method QUERY no longer panics in AddOperation; the
operation is stored under PathItem.Query (OpenAPI 3.2), with a
huma.Query convenience wrapper and humatest Query helpers.
@leonklingele

Copy link
Copy Markdown
Contributor

Let's wait for golang/go#80134.

This branch has not been deployed

No deployments
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.

Feature request: support the HTTP QUERY method (RFC 10008)

2 participants