Skip to content

JSON content type detection not spec compliant #470

@henning-cg

Description

@henning-cg

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions