title: Response: Status 406 - spring
body: <p>When I do request I get 406 with message: </p>
  
  <blockquote>
    <p>"org.springframework.web.server.NotAcceptableStatusException: 406
    NOT_ACCEPTABLE \"Could not find acceptable representation\"\n\tat
    org.springframework.web.reactive.result.method.annotation.AbstractMessageWriterResultHandler.writeBody(AbstractMessageWriterResultHandler.java:156)</p>
  </blockquote>
  
  <p>I don't know how to fix it. Can you tell me why it doesn't work?</p>
  
  <pre><code>@PostMapping("/sign-in")
  fun signIn(@RequestBody request: SignInRequest): Mono&lt;ServerResponse&gt; {
      return userService.findByEmail(request.email)
              .flatMap {
                  return@flatMap if (it != null &amp;&amp; passwordEncoder.encode(it.password.toString()) == request.password) {
                      println("ok")
                      ok().body(BodyInserters.fromObject(AuthResponse(jwtUtil.generateToken(it))))
                  } else {
                      println("no ok")
                      notFound().build()
                  }
              }
  }
  </code></pre>