swisnl / json-api-server

Set up a JSON API in Laravel in just a few minutes.
MIT License
105 stars 19 forks source link

Compliance with specifications, http headers #12

Closed liepumartins closed 6 years ago

liepumartins commented 6 years ago

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.

bbrala commented 6 years ago

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

bbrala commented 6 years ago

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