Browse Source

Do not use Accept.best_match

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

Change-Id: Ida4ee116b870f8c673f6037f81a2695a8e4dde6d
Cyril Roelandt 7 months ago
parent
commit
64904ea9c9
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      glance/common/wsgi.py

+ 4
- 2
glance/common/wsgi.py View File

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

Loading…
Cancel
Save