kurierjs / kurier

TypeScript framework to create JSON:API compliant APIs
https://kurier.readthedocs.io/en/latest/
MIT License
61 stars 9 forks source link

Add `strict` mode to require `application/vnd.api+json` in `Content-Type` header #290

Closed joelalejandro closed 3 years ago

joelalejandro commented 3 years ago

If I don't send a content-type Next detect body as content-type:'text/plain;charset=UTF-8' and body is a string. If I set 'content-type': 'application/json' then body is automatically parsed to object by Next.js. Finally, if I set 'content-type': 'application/vnd.api+json' body will be string again.

Should Kurier only allow 'content-type': 'application/vnd.api+json'? https://jsonapi.org/format/1.1/#introduction

JSON:API requires use of the JSON:API media type (application/vnd.api+json) for exchanging data.

_Originally posted by @isBatak in https://github.com/kurierjs/kurier/pull/285#discussion_r656806119_

joelalejandro commented 3 years ago

We're going to add a strict mode option in Application to enforce the media type required by the spec.