Skip to content

Add HTTP QUERY method support (RFC 10008)#3454

Open
kumarprabhashanand wants to merge 1 commit into
OpenFeign:masterfrom
kumarprabhashanand:implement-http-query-verb
Open

Add HTTP QUERY method support (RFC 10008)#3454
kumarprabhashanand wants to merge 1 commit into
OpenFeign:masterfrom
kumarprabhashanand:implement-http-query-verb

Conversation

@kumarprabhashanand

@kumarprabhashanand kumarprabhashanand commented Jun 27, 2026

Copy link
Copy Markdown

RFC 10008 defines QUERY as a safe, idempotent, cacheable HTTP method that carries a request body describing query criteria - a body carrying counterpart to GET.

Core

  • Request.HttpMethod.QUERY(true) registered as a first-class method
  • RequestLine Javadoc updated to list QUERY as a valid method name

Mock client

  • feign.mock.HttpMethod gains a QUERY constant; without it, RequestKey.create(Request) threw IllegalArgumentException on any QUERY request routed through MockClient
  • MockClientTest adds queryMock() to verify end-to-end routing

Client tests

  • AbstractClientTest adds a query() test verifying that QUERY transmits a body with the correct Content-Type and Content-Length
  • DefaultClientTest overrides query() to assert RetryableException wrapping ProtocolException - HttpURLConnection.setRequestMethod does not accept QUERY (mirrors the existing PATCH pattern)
  • GoogleHttpClientTest and AbstractJAXRSClientTest override query() for the same reason (both delegate to HttpURLConnection under the hood)

HTTP cache

  • HttpCacheInterceptor includes QUERY in its default cacheable set
  • Cache key incorporates Arrays.hashCode(body) when a request body is present to reduce cross-body collisions
  • HttpCacheInterceptorTest verifies that distinct bodies produce separate cache entries and that same-body repeats trigger conditional revalidation

Out of scope: Accept-Query response header (RFC 10008 §6) is not implemented; servers indicate QUERY support via Allow already.

RFC 10008 defines QUERY as a safe, idempotent, cacheable HTTP method
that carries a request body describing query criteria — a body-carrying
counterpart to GET.

- `Request.HttpMethod.QUERY(true)` registered as a first-class method
- `RequestLine` Javadoc updated to list QUERY as a valid method name

- `feign.mock.HttpMethod` gains a `QUERY` constant; without it,
  `RequestKey.create(Request)` threw `IllegalArgumentException` on any
  QUERY request routed through `MockClient`
- `MockClientTest` adds `queryMock()` to verify end-to-end routing

- `AbstractClientTest` adds a `query()` test verifying that QUERY
  transmits a body with the correct `Content-Type` and `Content-Length`
- `DefaultClientTest` overrides `query()` to assert `RetryableException`
  wrapping `ProtocolException` — `HttpURLConnection.setRequestMethod`
  does not accept QUERY (mirrors the existing PATCH pattern)
- `GoogleHttpClientTest` and `AbstractJAXRSClientTest` override `query()`
  for the same reason (both delegate to `HttpURLConnection` under the hood)

- `HttpCacheInterceptor` includes QUERY in its default cacheable set
- Cache key incorporates `Arrays.hashCode(body)` when a request body is
  present to reduce cross-body collisions
- `HttpCacheInterceptorTest` verifies that distinct bodies produce
  separate cache entries and that same-body repeats trigger conditional
  revalidation

**Out of scope:** `Accept-Query` response header (RFC 10008 §6) is not
implemented; servers indicate QUERY support via `Allow` already.
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.

1 participant