Announcement Announcement Module
Collapse
No announcement yet.
RestTemplate Client exchange expects different response body for ResponseErrorHandler Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • RestTemplate Client exchange expects different response body for ResponseErrorHandler

    Hi,

    I am using RestTemplate as a Client to a server. I use RestTemplate.exchange to send the HTTP POST and indicate that I expect a specific object for the response body. However, if there is a failure on the server side, the server will respond with a response statuscode of 4xx or 5xx and will include an error object in the response body.

    I cannot figure out in RestTemplate ResponseErrorHandler how to process an 4xx or 5xx error and map the response.getBody() to an expected error response object. Anyone have any ideas? Is this supported in Spring?

    Thanks,
    Brian

  • #2
    Hi, you can see here a workaround.

    Comment

    Working...
    X