diff --git a/java11/src/main/java/feign/http2client/Http2Client.java b/java11/src/main/java/feign/http2client/Http2Client.java index 1065c989..55d69821 100644 --- a/java11/src/main/java/feign/http2client/Http2Client.java +++ b/java11/src/main/java/feign/http2client/Http2Client.java @@ -190,20 +190,7 @@ public class Http2Client implements Client, AsyncClient { requestBuilder.headers(asString(headers)); } - switch (request.httpMethod()) { - case GET: - return requestBuilder.GET(); - case POST: - return requestBuilder.POST(body); - case PUT: - return requestBuilder.PUT(body); - case DELETE: - return requestBuilder.DELETE(); - default: - // fall back scenario, http implementations may restrict some methods - return requestBuilder.method(request.httpMethod().toString(), body); - } - + return requestBuilder.method(request.httpMethod().toString(), body); } /** diff --git a/java11/src/test/java/feign/http2client/test/Http2ClientTest.java b/java11/src/test/java/feign/http2client/test/Http2ClientTest.java index 0e03fcb0..e1fb6995 100644 --- a/java11/src/test/java/feign/http2client/test/Http2ClientTest.java +++ b/java11/src/test/java/feign/http2client/test/Http2ClientTest.java @@ -44,6 +44,14 @@ public class Http2ClientTest extends AbstractClientTest { @RequestLine("POST /timeout") @Headers({"Accept: text/plain"}) String timeout(); + + @RequestLine("GET /anything") + @Body("some request body") + String getWithBody(); + + @RequestLine("DELETE /anything") + @Body("some request body") + String deleteWithBody(); } @Override @@ -115,6 +123,24 @@ public class Http2ClientTest extends AbstractClientTest { api.timeout(); } + @Test + public void testGetWithRequestBody() { + final TestInterface api = + newBuilder().target(TestInterface.class, "https://nghttp2.org/httpbin/"); + String result = api.getWithBody(); + Assertions.assertThat(result) + .contains("\"data\": \"some request body\""); + } + + @Test + public void testDeleteWithRequestBody() { + final TestInterface api = + newBuilder().target(TestInterface.class, "https://nghttp2.org/httpbin/"); + String result = api.deleteWithBody(); + Assertions.assertThat(result) + .contains("\"data\": \"some request body\""); + } + @Override public Feign.Builder newBuilder() { return Feign.builder().client(new Http2Client());