swisnl/json-api-server

Compliance with specifications, http headers

Closed this issue · 2 comments

https://jsonapi.org/format/#fetching-resources states that request such as this

GET /articles HTTP/1.1
Accept: application/vnd.api+json

should retrieve results. But it does not.

InspectContentType::class, checks a different header Content-Type: application/vnd.api+json

GET /articles HTTP/1.1
Accept: application/vnd.api+json

Am I reading the specification correctly or did I just made a complete fool of myself and this is not a bug?

So, to summarize:
curl --header "Content-Type: application/vnd.api+json" http://localhost:4000/samples/ works
curl --header "Accept: application/vnd.api+json" http://localhost:4000/samples/ does not, but as I understand, it should.

You are correct, i double-checked the specification and using Accept should be totally fine. I've make a PR for this fix.

Thanks for the issue, i've merged the fix and will do a small release soon.