Do not use Accept.best_match

Accept.best_match has been deprecated, and acceptable_offers should be
used instead.

Change-Id: Ida4ee116b870f8c673f6037f81a2695a8e4dde6d
This commit is contained in:
Cyril Roelandt 2018-09-18 20:37:50 +02:00
parent 3e97060669
commit 64904ea9c9
1 changed files with 4 additions and 2 deletions

View File

@ -1027,8 +1027,10 @@ class Request(webob.Request):
def best_match_content_type(self): def best_match_content_type(self):
"""Determine the requested response content-type.""" """Determine the requested response content-type."""
supported = ('application/json',) supported = ('application/json',)
bm = self.accept.best_match(supported) best_matches = self.accept.acceptable_offers(supported)
return bm or 'application/json' if not best_matches:
return 'application/json'
return best_matches[0][0]
def get_content_type(self, allowed_content_types): def get_content_type(self, allowed_content_types):
"""Determine content type of the request body.""" """Determine content type of the request body."""