title: Why Spring Boot application does not work with relative quality factor of HTTP?
body: <p>Lets suppose I have a Spring Boot application:</p>
  <pre><code>dependencies {
    implementation(&quot;org.springframework.boot:spring-boot-starter-webflux:2.4.0&quot;)
  }
  </code></pre>
  <p>with a simple RestController:</p>
  <pre><code>@RestController
  class TestController {
    @PostMapping(&quot;/test&quot;)
    suspend fun test(@RequestBody request: Map&lt;String, String&gt;) {
      throw RuntimeException(&quot;test&quot;)
    }
  }
  </code></pre>
  <p>When I use <a href="https://httpie.io/" rel="nofollow noreferrer">httpie</a> client to make requests, then the result looks like:</p>
  <pre><code>➜  ~ http post :8080/test param=value --verbose
  POST /test HTTP/1.1
  Accept: application/json, */*;q=0.5
  Accept-Encoding: gzip, deflate
  Connection: keep-alive
  Content-Length: 18
  Content-Type: application/json
  Host: localhost:8080
  User-Agent: HTTPie/2.3.0
  
  {
      &quot;param&quot;: &quot;value&quot;
  }
  
  
  HTTP/1.1 500 Internal Server Error
  Cache-Control: no-cache, no-store, max-age=0, must-revalidate
  Content-Length: 309
  Content-Type: text/html;charset=UTF-8
  Expires: 0
  Pragma: no-cache
  Referrer-Policy: no-referrer
  X-Content-Type-Options: nosniff
  X-Frame-Options: DENY
  X-XSS-Protection: 1 ; mode=block
  
  &lt;html&gt;&lt;body&gt;&lt;h1&gt;Whitelabel Error Page&lt;/h1&gt;&lt;p&gt;This application has no configured error view, so you are seeing this as a fallback.&lt;/p&gt;&lt;div id='created'&gt;Wed Dec 09 22:24:52 MSK 2020&lt;/div&gt;&lt;div&gt;[906bb33e-5] There was an unexpected error (type=Internal Server Error, status=500).&lt;/div&gt;&lt;div&gt;test&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;
  </code></pre>
  <p>When I use cURL:</p>
  <pre><code>➜  ~ curl -XPOST localhost:8080/test -d '{&quot;param&quot;: &quot;value&quot;}' -H &quot;Content-type: application/json&quot; -v
  Note: Unnecessary use of -X or --request, POST is already inferred.
  *   Trying ::1...
  * TCP_NODELAY set
  * Connected to localhost (::1) port 8080 (#0)
  &gt; POST /test HTTP/1.1
  &gt; Host: localhost:8080
  &gt; User-Agent: curl/7.64.1
  &gt; Accept: */*
  &gt; Content-type: application/json
  &gt; Content-Length: 18
  &gt;
  * upload completely sent off: 18 out of 18 bytes
  &lt; HTTP/1.1 500 Internal Server Error
  &lt; Content-Type: application/json
  &lt; Content-Length: 170
  &lt; Cache-Control: no-cache, no-store, max-age=0, must-revalidate
  &lt; Pragma: no-cache
  &lt; Expires: 0
  &lt; X-Content-Type-Options: nosniff
  &lt; X-Frame-Options: DENY
  &lt; X-XSS-Protection: 1 ; mode=block
  &lt; Referrer-Policy: no-referrer
  &lt;
  * Connection #0 to host localhost left intact
  {&quot;timestamp&quot;:1607541989698,&quot;path&quot;:&quot;/test&quot;,&quot;status&quot;:500,&quot;error&quot;:&quot;Internal Server Error&quot;,&quot;message&quot;:&quot;test&quot;,&quot;requestId&quot;:&quot;7f249f68-9&quot;,&quot;exception&quot;:&quot;java.lang.RuntimeException&quot;}* Closing connection 0
  </code></pre>
  <p>The difference in header <code>Accept</code>. Httpie uses <code>Accept: application/json, */*;q=0.5</code> header with <a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html" rel="nofollow noreferrer"><strong>relative quality factor</strong></a> 0.5 and, despite the fact that I requested JSON if possible (and it's possible), the application returns HTML representation.</p>
  <p>Is it how Spring Boot should work and I do something wrong?</p>
  <p><strong>UPD</strong>: Everything works fine with Tomcat (<code>spring-boot-starter-web</code>). After some debugging I found that, when Tomcat used, errors are handled by <code>org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController</code> and for Netty it is <code>org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler</code>. It looks like the source of misbehavior is <a href="https://github.com/spring-projects/spring-boot/blob/v2.4.0/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java#L257" rel="nofollow noreferrer">here</a>: when <code>MediaType.ALL</code>  is removed from <code>acceptedMediaTypes </code>.</p>