jshttp / type-is

Infer the content-type of a request.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for application/vnd.api+json

digitalsadhu opened this issue · comments

This is the media type JSON API uses and should be treated as JSON. Am I correct in understanding that currently this media type is not directly supported?

Am I correct in understanding that currently this media type is not directly supported?

That is not correct as far as I know. Can you explain how you came to this conclusion? Perhaps it's just a misunderstanding of the documentation in the README?

I'm sure I'm wrong, made the assumption when looking at body parser after finding that it doesn't support application/vnd.api+json. I figured it was likely the case that type-is simply wasn't reporting application/vnd.api+json as json.

The body-parser documentation of type (https://github.com/expressjs/body-parser#type) says that it is specifically sending this module the type application/json, which is a distinctly different type from application/vnd.api+json.

Even if you give this module the string json, this module will expand it to the type for that file extension (https://github.com/jshttp/type-is#each-type-can-be), so .json files are application/json.

Awesome, thanks for the explanation. That clears things up nicely for me.