title: Get headers from response with Spring Boot 2 WebClient
body: <p>I would like to receive the headers (especially the content-type) from the webclient response.
  I found this code with flatmap-mono-getHeaders, but it doesn't work.</p>
  <p><code>org.springframework.web.reactive.function.UnsupportedMediaTypeException: Content type 'image/tiff' not supported for bodyType=org.company.MyResponse</code></p>
  <p>How can I fix it? Or maybe can someone recommend a simpler solution.</p>
  <pre><code>Mono&lt;Object&gt; mono = webClient.get()
                                  .uri(path)
                                  .acceptCharset(StandardCharsets.UTF_8)
                                  .retrieve()
                                  .toEntity(MyResponse.class)
                                  .flatMap(entity -&gt; Mono.justOrEmpty(entity.getHeaders().getFirst(&quot;content-type&quot;)));
  Object rs = mono.block();
  public class MyResponse {
   Object body;
   Integer status;
   String contentType;
  }
  </code></pre>