Add HTTP QUERY method support (RFC 10008)#3454
Open
kumarprabhashanand wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 methodRequestLineJavadoc updated to list QUERY as a valid method nameMock client
feign.mock.HttpMethodgains aQUERYconstant; without it,RequestKey.create(Request)threwIllegalArgumentExceptionon any QUERY request routed throughMockClientMockClientTestaddsqueryMock()to verify end-to-end routingClient tests
AbstractClientTestadds aquery()test verifying that QUERY transmits a body with the correctContent-TypeandContent-LengthDefaultClientTestoverridesquery()to assertRetryableExceptionwrappingProtocolException-HttpURLConnection.setRequestMethoddoes not accept QUERY (mirrors the existing PATCH pattern)GoogleHttpClientTestandAbstractJAXRSClientTestoverridequery()for the same reason (both delegate toHttpURLConnectionunder the hood)HTTP cache
HttpCacheInterceptorincludes QUERY in its default cacheable setArrays.hashCode(body)when a request body is present to reduce cross-body collisionsHttpCacheInterceptorTestverifies that distinct bodies produce separate cache entries and that same-body repeats trigger conditional revalidationOut of scope:
Accept-Queryresponse header (RFC 10008 §6) is not implemented; servers indicate QUERY support viaAllowalready.