From c57b44e38727af4ce93ea703dc63d65d2831ace4 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Tue, 12 Apr 2016 20:42:22 -0600 Subject: For */* case, MIMEAccept picks first server offer This means that to make "text/plain" the default, we need to specifically make it the first thing we offer. For anything else, since the server offers are all weighted equally, the client order should be accepted. --- pyramid/httpexceptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyramid/httpexceptions.py b/pyramid/httpexceptions.py index 213e4b980..422f2f27f 100644 --- a/pyramid/httpexceptions.py +++ b/pyramid/httpexceptions.py @@ -249,9 +249,9 @@ ${body}''') accept_value = environ.get('HTTP_ACCEPT', '') accept = MIMEAccept(accept_value) match = accept.best_match( - ['application/json', + ['text/plain', 'text/html', - 'text/plain'], default_match='text/plain') + 'application/json'], default_match='text/plain') if match == 'text/html': self.content_type = 'text/html' -- cgit v1.2.3