Closed
Description
David Victor opened SPR-8016* and commented
I am working with an API which returns an empty response body on http status 200 (OK) & a body which is populated on http status 400 (Bad Request).
When using RestTemplate.getForEntity() this is fine for the case where the body is populated, however I get an exception for the 'null body' case.
My understanding is one should provide a class implementing the ResponseBody interface & make the call via the execute() method on the RestTemplate.
This task is a request to consider that the use case here is common & whether Spring should offer something out of the box for this situation.
Affects: 3.1 M1
Issue Links:
- Better handling of 204 No Content in RestTemplate [SPR-7911] #12566 Better handling of 204 No Content in RestTemplate ("duplicates")
- Resttemplate with HttpComponentsClientHttpRequestFactory will make HttpMessageConverterExtractor.extractData return null if the header contains content-encoding gzip, the connection is closed and the response isn't chunked [SPR-12968] #17560 Resttemplate with HttpComponentsClientHttpRequestFactory will make HttpMessageConverterExtractor.extractData return null if the header contains content-encoding gzip, the connection is closed and the response isn't chunked ("is duplicated by")
- RestTemplate cannot handle GZIP response since 4.1.3 [SPR-12712] #17309 RestTemplate cannot handle GZIP response since 4.1.3 ("is duplicated by")
9 votes, 19 watchers