use of feign.Response in project feign by OpenFeign.
the class JacksonJaxbCodecTest method notFoundDecodesToEmpty.
/** Enabled via {@link feign.Feign.Builder#decode404()} */
@Test
public void notFoundDecodesToEmpty() throws Exception {
Response response = Response.builder().status(404).reason("NOT FOUND").headers(Collections.<String, Collection<String>>emptyMap()).build();
assertThat((byte[]) new JacksonJaxbJsonDecoder().decode(response, byte[].class)).isEmpty();
}
use of feign.Response in project feign by OpenFeign.
the class DefaultErrorDecoderTest method throwsFeignExceptionIncludingBody.
@Test
public void throwsFeignExceptionIncludingBody() throws Throwable {
thrown.expect(FeignException.class);
thrown.expectMessage("status 500 reading Service#foo(); content:\nhello world");
Response response = Response.builder().status(500).reason("Internal server error").headers(headers).body("hello world", UTF_8).build();
throw errorDecoder.decode("Service#foo()", response);
}
use of feign.Response in project feign by OpenFeign.
the class AbstractClientTest method postWithSpacesInPath.
@Test
public void postWithSpacesInPath() throws IOException, InterruptedException {
server.enqueue(new MockResponse().setBody("foo"));
TestInterface api = newBuilder().target(TestInterface.class, "http://localhost:" + server.getPort());
Response response = api.post("current documents", "foo");
MockWebServerAssertions.assertThat(server.takeRequest()).hasMethod("POST").hasPath("/path/current%20documents/resource").hasBody("foo");
}
use of feign.Response in project feign by OpenFeign.
the class JacksonCodecTest method notFoundDecodesToEmpty.
/** Enabled via {@link feign.Feign.Builder#decode404()} */
@Test
public void notFoundDecodesToEmpty() throws Exception {
Response response = Response.builder().status(404).reason("NOT FOUND").headers(Collections.<String, Collection<String>>emptyMap()).build();
assertThat((byte[]) new JacksonDecoder().decode(response, byte[].class)).isEmpty();
}
use of feign.Response in project feign by OpenFeign.
the class JAXBCodecTest method notFoundDecodesToEmpty.
/** Enabled via {@link feign.Feign.Builder#decode404()} */
@Test
public void notFoundDecodesToEmpty() throws Exception {
Response response = Response.builder().status(404).reason("NOT FOUND").headers(Collections.<String, Collection<String>>emptyMap()).build();
assertThat((byte[]) new JAXBDecoder(new JAXBContextFactory.Builder().build()).decode(response, byte[].class)).isEmpty();
}
Aggregations