twilio/flask-restful — pull request #245 by jrandall (2014-05-31 17:07:50+00:00)
Title: Fixes content negotiation to respect q-values

Uses werkzeug's `Accept.best_match` to decide on the best representation
based on client's Accept header, including q-values.

Prior to this change, the flask-restful implementation ignored q-values
and used the order of the list of mime types in the Accept header to
decide which representation to use.

If `default_mediatype` is set in the API (which it is by default), it
will be used in case none of the representations are acceptable to the
client. If `default_mediatype` is set to `None`, a `NotAcceptable` exception
will be raised, resulting in an HTTP 406 status code.

This also updates the `mediatypes()` method to return the list of
mediatypes sorted in descending quality order, although possibly
it could be removed instead, as an ordered list without quality values
is not enough to properly implement matching.