Update retrieve() in RestClient to execute and extract in single scope #33777
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
The
retrieve()
workflow inRestClient
splits the exchange over two method calls. The call toretrieve()
executes the request but doesn't extract, and the subsequent call to one of theResponseSpec
methods actually extracts the response.This makes sense but it's also reasonable to conclude you can just call
retrieve()
if you don't care for the response. In that case, however, the observation scope remains open, the status is not checked, and the connection is not closed.retrieve()
should merely a step towards fully declaring the exchange before, and only once aResponseSpec
method is selected should we proceed with execution and response extraction. Same way it works with the RestTemplate.This will make the
retrieve()
workflow a true shortcut for callingexchange()
, fully scoped within a call toexchange()
with a built-inExchangeFunction
based on theResponseSpec
selection. If an application actually wants to split execution and extraction into separate steps, it can use theexchange
variants.The text was updated successfully, but these errors were encountered: