title: Return the complete response using Spring WebClient
body: <p>I have the following code</p>
  <pre><code>public ClientResponse doGet(HttpServletRequest request, URI uri) {
      return webClient.get()
              .uri(uri.toASCIIString())
              .headers(headers -&gt; headers.putAll(processRequest(request))
              .exchange()
              .block();
  }
  </code></pre>
  <p>But when I try to return this ClientResponse through the RestController as follows,</p>
  <pre><code>@GetMapping
  @ResponseBody
  public ClientResponse doGet(HttpServletRequest request) {
      ClientResponse node = service.doGet(request);
      return node;
  }
  </code></pre>
  <p>I get the following error:</p>
  <blockquote>
  <p>org.springframework.http.converter.HttpMessageNotWritableException: No
  converter found for return value of type: class
  org.springframework.web.reactive.function.client.DefaultClientResponse</p>
  </blockquote>
  <p>Basically, the ultimate goal I want is to <strong>return the actual response back to the invoker - including the headers, body, cookies</strong> etc.</p>
  <p>I was thinking of using ResponseEntity like follows.</p>
  <pre><code>public ResponseEntity&lt;JsonNode&gt; doGet2(HttpServletRequest request, URI uri) {
  
      Mono&lt;ClientResponse&gt; clientResponse = webClient.get()
              .uri(uri.toASCIIString())
              .headers(headers -&gt; headers.putAll(processRequest(request))
              .exchange();
  
      HttpHeaders headers = clientResponse.map(resp -&gt; resp.headers().asHttpHeaders()).block();
      JsonNode body = clientResponse.flatMap(resp -&gt; resp.bodyToMono(JsonNode.class)).block();
  
      ResponseEntity&lt;JsonNode&gt; jsonNode = ResponseEntity.ok().headers(headers).body(body);
      return jsonNode;
  }
  </code></pre>
  <p>But this is again an overkill. Is there a way to return the response directly using WebClient instead of restructuring the response?</p>