title: Return output of flatMap from Spring Reactive POST request
body: <p>I am trying to build a POST request using Spring WebFlux reactive programming. Below is my handler code:</p>
  <pre><code>public Mono&lt;ServerResponse&gt; getDataPOST(ServerRequest request) {
      Mono&lt;Request&gt; requestBodyMono = request.bodyToMono(Request.class);
      Mono&lt;ServerResponse&gt; responseBodyMono =  requestBodyMono.flatMap(requestBodyObj -&gt; {
          Mono&lt;ServerResponse&gt; response = someFunction(); //Returns Mono&lt;ServerResponse&gt;
          return response;
      });
      return responseBodyMono;
  } 
  
  public Mono&lt;ServerResponse&gt; someFunction() {
      //..Some processing..
      String body = &quot;Some body after processing&quot;;
      return ServerResponse.ok().bodyValue(body);
  }
  </code></pre>
  <p>The code is getting compiled without errors but when I run and call the request, I get an empty response. This is because my <code>responseBodyMono</code> is not getting any data. After debugging, I found that the code inside the <code>flatMap</code> method is not getting executed (perhaps because it is async?). How can I get the response returned correctly?</p>