Expose default error handling from RequestHeadersSpec::retrieve for use with RequestHeadersSpec::exchange #22825
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Affects: 5.1
This is an enhancement request around the
RequestHeadersSpec::exchange
andRequestHeadersSpec::retrieve
methods.Per the documentation for
retrieve
:The decoding mentioned here also includes some default error handling that converts 4XX and 5XX status responses to
WebClientResponseException
s as follows:I would like to be able to apply this same error-handling to results of
exchange
before performing my own processing, so that error handling is unified across all requests (regardless of whether they are implemented usingexchange
+ additional processing, orretrieve
).Would it be possible to expose this error-handling functionality publicly so that it can be composited with other response processing? I'm not sure what the appropriate mechanism would be if so, but it looks like some related discussion occurred in #22368.
If not, would the recommendation be to always prefer
exchange
overretrieve
and to reimplement the logic above in a sharedExchangeFilterFunction
?The text was updated successfully, but these errors were encountered: