title: How to change response HTTP status of Spring WebClient
body: <p>I have got a situation that is needed to return HTTP 2XX when WebClient returns any kind of 4XX.</p>
  <p>My existing code below,</p>
  <pre><code>public Mono&lt;ResponseEntity&lt;&gt;String&gt; postMethodA(String valueA) {
    
     return webClient
            .put()
            .uri'/')
            .bodyValue(valueA)
            .retrieve()
            .toEntity(String.class);
  }
  </code></pre>
  <p>I added onStatus method like this.</p>
  <pre><code>public Mono&lt;ResponseEntity&lt;&gt;String&gt; postMethodA(String valueA) {
    
     return webClient
            .put()
            .uri'/')
            .bodyValue(valueA)
            .retrieve()
            .onStatus(HttpStatus::is4XXClientError response -&gt; Mono.empty())
            .toEntity(String.class);
  }
  
  </code></pre>
  <p>If I added</p>
  <pre><code>onStatus(HttpStatus::is4XXClientError response -&gt; Mono.empty())
  </code></pre>
  <p>still, it is not gonna work because it is not able to return 2XX.</p>
  <p>Is there a way to change the Http status when returning the response? and can you please show some example?</p>