title: Swagger-UI doesn't recognize application/hal+json
body: <p>I have RESTful API for a Spring Boot application. I ran into this when I was trying to figure out a separate issue that involved trying to add custom media-types. </p>
  
  <p>After trying to do this I got a <code>HttpMediaTypeNotAcceptable</code> exception when I try to view my API documentation. This exception is visible only in the logs (if I turn the level up to <code>DEBUG</code>). On the browser I see <code>406 undefined</code>. Here's a screenshot:</p>
  
  <p><img src="https://i.stack.imgur.com/tXLEv.png" alt="enter image description here"></p>
  
  <p>The exception I get from Spring Boot's logs is this:</p>
  
  <pre><code>2014-11-04 10:08:26.189 DEBUG 5496 --- [nio-8080-exec-9] .w.s.m.s.DefaultHandlerExceptionResolver : Resolving exception from handler [public org.springframework.http.ResponseEntity&lt;com.wordnik.swagger.model.ResourceListing&gt; com.mangofactory.swagger.controllers.DefaultSwaggerController.getResourceListing(java.lang.String)]: org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
  </code></pre>
  
  <p>The root of the problem is that the existing, producible-media-types are overwritten.</p>
  
  <p>Without the code above, the list contains:</p>
  
  <ul>
  <li><code>application/hal+json</code></li>
  <li><code>application/json;charset=UTF-8</code></li>
  <li><code>application/*+json;charset=UTF-8</code>. </li>
  </ul>
  
  <p>With my changes, the list only contains <code>application/hal+json</code> and my custom media-type. So what happens is that Spring cannot find a compatible media-type at all because Swagger UI has <code>application/json</code> in its <code>Accept:</code> header whereas <code>http://localhost:8080/api-docs</code> vends <code>application/hal+json</code> (I verified using curl):</p>
  
  <pre><code>HTTP/1.1 200 OK
  Server: Apache-Coyote/1.1
  X-Content-Type-Options: nosniff
  X-XSS-Protection: 1; mode=block
  Cache-Control: no-cache, no-store, max-age=0, must-revalidate
  Pragma: no-cache
  Expires: 0
  X-Frame-Options: DENY
  X-Application-Context: application
  Content-Type: application/hal+json
  Transfer-Encoding: chunked
  Date: Tue, 04 Nov 2014 16:56:57 GMT
  </code></pre>
  
  <p>I'm guessing that Swagger UI should probably set the accept header to <code>application/json,application/hal+json</code> or perhaps use a wildcard like <code>application/*+json</code>.  </p>