In order to handle non standard HTTP Status codes returned by services in RestTemplate, I would like to add support for handling non standard status codes and passing on responses for these responses to callers [SPR-9311] #13949
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: declined
A suggestion or change that we don't feel we should currently apply
type: enhancement
A general enhancement
harish opened SPR-9311 and commented
Currently Resttemplate uses an enum of 'standard' HTTP status codes, that is subset of all legally possible HTTP status codes that services can return. When a non standard HTTP status code is returned by services, an IllegalArgumentException is thrown and all response body is ignored. We call services that use custom code 450 for user validation errors along with an xml containing list of messages codes and message text. Unfortunately we get only an illegal argument exception and response body is lost. I think it would be helpful if say all 4xx, 1xx, 2xx, 5xx are treated as legal responses and their response bodies are preserved and passed to the caller. At the least a hook could be provided to extend the enum used by Resttemplate to add additional HTTP codes that caller might expect.
Issue Links:
2 votes, 3 watchers
The text was updated successfully, but these errors were encountered: