Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Made mimetype negotiation much more spec compliant #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexkalderimis
Copy link

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.

jackfirth added a commit to jackfirth/flask-negotiate that referenced this pull request Sep 18, 2015
@timothyqiu
Copy link

I think

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

might be enough to handle this.

@dholiday-splunk
Copy link

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!

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

Successfully merging this pull request may close these issues.

None yet

3 participants