While working on #912 I came across an odd behaviour:
In errorStatus a FeignException is created with the response's body:
|
body = Util.toByteArray(response.body().asInputStream()); |
In errorReading a FeignException is created with the request's body (even though the response with its body would be at hand):
I think it's inconsistent and confusing for the user as he or she can't rely on the same data-source for all exceptions. On the other hand, I'm not sure whether it's intentional as there are unit-tests that check this behaviour, thus changing it could also be breaking-change for users:
|
assertThat(e.contentUTF8()).isEqualTo("Request body"); |
If we agree on returning the response-body, I'd gladly create a PR for it.
While working on #912 I came across an odd behaviour:
In
errorStatusaFeignExceptionis created with the response's body:feign/core/src/main/java/feign/FeignException.java
Line 81 in ce66205
In
errorReadingaFeignExceptionis created with the request's body (even though the response with its body would be at hand):feign/core/src/main/java/feign/FeignException.java
Line 72 in ce66205
I think it's inconsistent and confusing for the user as he or she can't rely on the same data-source for all exceptions. On the other hand, I'm not sure whether it's intentional as there are unit-tests that check this behaviour, thus changing it could also be breaking-change for users:
feign/core/src/test/java/feign/FeignTest.java
Line 525 in ce66205
If we agree on returning the response-body, I'd gladly create a PR for it.