title: How to validate response object in Spring WebClient
body: <p>I am using <em><strong>Springs' Webclient</strong></em> to make a <strong>HTTP GET</strong> call.</p>
  <p>How can I validate the response object <code>GetPersonBasicInfoResWrapper</code>'s property that I received as a response of my HTTP call.</p>
  <p>I am trying to validate the <code>birthDate</code> inside the <code>flatMap</code> by blocking the response object, but it doesn't look like the most functional way of doing it.</p>
  <p>Following is the excerpt from my code.</p>
  <pre><code>private Mono&lt;GetPersonBasicInfoResWrapper&gt; getPersonBasicInfo(Double personId, LocalDate birthDate,
              CallerRequestMetaData callerInfo) {
          return middlewareWebClient
                  .get()
                  .uri(...)
                  ...
                  ...
                  .exchange()
                  .flatMap(client -&gt; {
                      GetPersonBasicInfoResWrapper block = client.bodyToMono(GetPersonBasicInfoResWrapper.class).block();
                      
                      LocalDate personBirthDate = LocalDateTime.ofInstant(block.getBirthDate().toInstant(),ZoneId.of(Constants.DEFAULT_TIME_ZOME)).toLocalDate();
                      
                      if (!personBirthDate.equals(birthDate))
                          throw new YakeenRowadException(Errors.INCORRECT_ID_BIRTH_DATE_G, birthDate.toString()); 
                      else
                          return client.bodyToMono(GetPersonBasicInfoResWrapper.class);
                  });
  }
  </code></pre>
  <p>Any help is highly appreciated.</p>