Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON content type detection not spec compliant #470

Closed
henning-cg opened this issue Aug 23, 2022 · 0 comments · Fixed by #471
Closed

JSON content type detection not spec compliant #470

henning-cg opened this issue Aug 23, 2022 · 0 comments · Fixed by #471
Milestone

Comments

@henning-cg
Copy link

henning-cg commented Aug 23, 2022

The logic for detecting if the datacontenttype is JSON seems to be contrary to the current spec.

The spec states that:

Such a content type is defined as one having a media subtype equal to json or ending with a +json format extension. That is, a datacontenttype declares JSON-formatted content if its media type, when stripped of parameters, has the form */json or */*+json. If the datacontenttype is unspecified, processing SHOULD proceed as if the datacontenttype had been specified explicitly as application/json

but the code at

return contentType == null || contentType.startsWith("application/json") || contentType.startsWith("text/json");
only checks for empty datacontenttype, application/json or text/json, and is not taking into account for example the extension case "application/something+json"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants