I have a Spring service calling a Spring Rest endpoint with RestTemplate.postForEntity
. I can step through the Rest controller and see that it creates and returns a ResponseEntity
with Status Code 500 -Internal Server Error which is expected in my use case. However the calling spring Service is throwing a RestClientException
rather than receiving the ResponseEntity
with status code.
Does RestTemplate.postForEntity
throw a RestClientException
when receiving an ResponseEntity
with a status code that isn't a 2xx?