use of feign.Body in project feign by OpenFeign.
the class Http2ClientAsyncTest method throwsFeignExceptionIncludingBody.
@Test
public void throwsFeignExceptionIncludingBody() throws Throwable {
server.enqueue(new MockResponse().setBody("success!"));
final TestInterfaceAsync api = newAsyncBuilder().decoder((response, type) -> {
throw new IOException("timeout");
}).target("http://localhost:" + server.getPort());
final CompletableFuture<?> cf = api.body("Request body");
server.takeRequest();
try {
unwrap(cf);
} catch (final FeignException e) {
Assertions.assertThat(e.getMessage()).isEqualTo("timeout reading POST http://localhost:" + server.getPort() + "/");
Assertions.assertThat(e.contentUTF8()).isEqualTo("Request body");
return;
}
fail();
}
Aggregations