Updates DefaultResponseErrorHandler.handleError(ClientHttpReponse) to read the response body once and reuse it for creating exception message and parameter.

Comment From: sbrannen

Thanks for the PR.

Based on the provided tests, I assume the undesired behavior is an empty body in the UnknownHttpStatusCodeException for use cases where the InputStream has already been consumed by the first invocation of getResponseBody().

Just a few questions...

  • Did this once work correctly for you?
  • In which version or versions of Spring Framework do you witness the undesired behavior?

Comment From: awoodbury

Thanks for the PR.

Based on the provided tests, I assume the undesired behavior is an empty body in the UnknownHttpStatusCodeException for use cases where the InputStream has already been consumed by the first invocation of getResponseBody().

Just a few questions...

  • Did this once work correctly for you?
  • In which version or versions of Spring Framework do you witness the undesired behavior?

That is correct - the undesired behavior is the empty body in the UnknownHttpStatusCodeException.

Yes it used to work correctly in 5.1.10; and then upgraded to 5.2.3 and the undesired behavior appeared.

Comment From: rstoyanchev

I believe this was introduced in this commit as part of #1956.

Comment From: sbrannen

This has been merged into master in 2fb13d410d3938a8c4e875247e5e50eee1406f4b and refined in 17140c8d4b6f9bdd50b96c67fbcbd31dda74d113.

Thanks