title: WebClient 5.3+ exchange vs exchangeToMono. Extracting cookies and body together
body: <p>I am currently trying to consume a whole request coming back via webClient. I need to be able to read the <em>body</em> and the <em>cookies</em> that come with it. However I am currently having issues doing both together in one call. Below I have two ways of grabbing the data I want. I am pretty new at using lambdas and webClient. I do realize that exchangeToMono() is the latest method call to return a Mono or Flux because of the possible memory leak found in exchange().
  I want to say subscribing() to a return monoBody might help me but so far I have had no luck extracting the data out that way as well. Thank you all for your input.</p>
  <pre><code>Mono&lt;String&gt; monoBody = webBuilder.build()
                  .get()
                  .uri(baseURI + &quot;?Level=&amp;pageSize=50&amp;pageNo=&amp;name=&amp;id=&amp;authToken=&quot; + sessionToken)
                  .accept(MediaType.ALL)
                  .header(&quot;authToken&quot;, sessionToken)
                  .header(&quot;x-Token&quot;, sessionToken)
                  .header(&quot;X-token-X&quot;, sessionToken)
                  .header(&quot;Ref&quot;, ref)
                  .exchangeToMono(clientResponse -&gt; clientResponse.bodyToMono(String.class));
  
   Mono&lt;MultiValueMap&lt;String,ResponseCookie&gt;&gt; monoMap = webBuilder.build()
                  .get()
                  .uri(baseURI + &quot;?Level=&amp;pageSize=50&amp;pageNo=&amp;unitName=&amp;id=&amp;authToken=&quot; + sessionToken)
                  .accept(MediaType.ALL)
                  .header(&quot;authToken&quot;, sessionToken)
                  .header(&quot;x-Token&quot;, sessionToken)
                  .header(&quot;X-token-X&quot;, sessionToken)
                  .header(&quot;Ref&quot;, ref)
                  .exchangeToMono(clientResponse -&gt; Mono.fromCallable(()-&gt; clientResponse.cookies() ));
      
  </code></pre>