I have a RESTful web server implemented with custom authentication and returns 401 plus a JSON response when authentication fails. When the authentication fails as on a GET, all is well and RestTemplate returns back both the status code as well as the JSON response but when we send a POST, the body gets lost. We see that an HttpRetryException is getting called when attempting to retrieve the responseBody. This is in function getResponseBody in DefaultResponseErrorHandler. I assume this means that the response is already retrieved at an earlier point and therefore gets lost.
Bug in Spring 3.1.1 RestTemplate Class in retrieving response Buffer on 401 error Page Title Module
Move Remove Collapse