From 64904ea9c9d86729739bea1737bfb9320258afe1 Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Tue, 18 Sep 2018 20:37:50 +0200 Subject: [PATCH] Do not use Accept.best_match Accept.best_match has been deprecated, and acceptable_offers should be used instead. Change-Id: Ida4ee116b870f8c673f6037f81a2695a8e4dde6d --- glance/common/wsgi.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/glance/common/wsgi.py b/glance/common/wsgi.py index 95d772ad3d..7ccd76a2f1 100644 --- a/glance/common/wsgi.py +++ b/glance/common/wsgi.py @@ -1027,8 +1027,10 @@ class Request(webob.Request): def best_match_content_type(self): """Determine the requested response content-type.""" supported = ('application/json',) - bm = self.accept.best_match(supported) - return bm or 'application/json' + best_matches = self.accept.acceptable_offers(supported) + if not best_matches: + return 'application/json' + return best_matches[0][0] def get_content_type(self, allowed_content_types): """Determine content type of the request body."""