pallets-eco / flask-negotiate

Content negotiation for Flask apps
MIT License
12 stars 3 forks source link

Made mimetype negotiation much more spec compliant #3

Open alexkalderimis opened 11 years ago

alexkalderimis commented 11 years ago

The current implementation only permits exact matches on mimetype strings, whereas Accept headers may contain wild cards (such as text/*, up to */*). This pull request includes tests, code and documentation to add the capacity to deal with wildcards. All current tests remain as they were, so the current behaviour should not break for anyone. I have also bumped the minor version to reflect the API change.

timothyqiu commented 8 years ago

I think

if not request.accept_mimetypes.best_match(content_types):
    raise NotAcceptable()

might be enough to handle this.

dholiday-splunk commented 2 years ago

I think

if not request.accept_mimetypes.best_match(content_types):
    raise NotAcceptable()

might be enough to handle this.

this totally worked for me - ty!