mikekelly / hal-browser

An API browser for the hal+json media type
MIT License
835 stars 157 forks source link

HTTP 406 with request header "Accept: application/hal+json" #35

Open basti1302 opened 10 years ago

basti1302 commented 10 years ago

When requesting HAL talk with "Accept: application/json" everything works fine:

$ curl -D - -H "accept: application/json" http://haltalk.herokuapp.com/
HTTP/1.1 200 OK 
Content-Type: application/json; charset=utf-8
...

{"_links":{"self":{"href":"/"},"curies": [...]

But with "Accept: application/hal+json" it doesn't:

$ curl -D - -H "accept: application/hal+json" http://haltalk.herokuapp.com/
HTTP/1.1 406 Not Acceptable 
Content-Type: text/html; charset=utf-8

This came as a surprise to me. Maybe I'm missing something here? The HAL spec states "A HAL Document uses the format described in [RFC4627] and has the media type "application/hal+json". The example directly below that statement reads

GET /orders/523 HTTP/1.1
Host: example.org
Accept: application/hal+json

HTTP/1.1 200 OK
Content-Type: application/hal+json

That's why I would have expected the HAL talk example to behave the same, that is

Might be related to #22.