falconry / falcon

The no-magic web data plane API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.
https://falcon.readthedocs.io/en/stable/
Apache License 2.0
9.49k stars 933 forks source link

Prefer exact match without parameters to match with extra parameters. #1367

Open suola opened 5 years ago

suola commented 5 years ago

If server supports both 'type/subtype' and 'type/subtype;param=foo', a request which accepts 'type/subtype' should be served with 'type/subtype'. Currently the extra parameter is not taken into account when determining the preference of the two types, and preference is selected by order of the types.

Relevant PR in mimeparse:

https://github.com/dbtsai/python-mimeparse/pull/36

vytas7 commented 4 years ago

Indeed, that sounds like a logical suggestion.

FWIW, we vendored python-mimeparse into Falcon as part of the 2.0 release as it was the last dependency. In that light, a question arises what to do with your PR if we agree to go ahead with it. Maybe we should ask @dbtsai to take over maintenance of the project :thinking: Or whether we should fork our version.

vytas7 commented 4 years ago

Note that I'm reluctant to label this as a breaking change, as we don't seem to provide exact guarantees how subtypes are chosen.

vytas7 commented 4 years ago

Related: