retrieve()
methods apply response status handling raising the appropriate RestClientResponseException
. exchange()
methods have a similar need, but must apply their own response status handling. Furthermore to decode the response body you need message converters, and there may be default status handlers configured on RestClient.Builder
.
The motivation is very similar to #22825 for WebClient
in 5.2. The same does not yet exist for RestClient
. We can expose an additional method on ConvertibleClientHttpResponse
to create a RestClientResponseException
.
See https://github.com/spring-projects/spring-framework/issues/35375#issuecomment-3227725041 for more background on how the need for this came up.