Skip to content

Make media type parsing strict #63080

@pgomulka

Description

@pgomulka

at the moment, we do not throw an explicit exception when an unsupported media type is used either in code or by users.
We should validate this when parsing and throw an explicit error to the user.
This will require changes across the codebase were we rely on parsing returning null and the logic is retrying parsing in a different way (a value from content-type or format parameter)

Also important to not allow java default accept header "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" which is sets by sun.net.www.protocol.http.HttpURLConnection

Make / parsing strict to return JSON

Unknown parameters for a known media type should also throw an exception
Validation of charset parameter should be enforced. Deprecation warnings for charset should be emitted in 7.x

comments #61427 (comment)

relates #61427

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Core/Infra/REST APIREST infrastructure and utilities>enhancementTeam:Core/InfraMeta label for core/infra teamtriagedIssue has been looked at, and is being left open

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions