From 80f9822d85ba7e7efedff90648a336594171a3d6 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Thu, 14 Apr 2016 01:06:35 -0600 Subject: Make text/html the preferred server return This matches the original code whereby it would return an HTML page if you sent an Accept header of */*. --- pyramid/httpexceptions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyramid/httpexceptions.py b/pyramid/httpexceptions.py index 422f2f27f..893795c11 100644 --- a/pyramid/httpexceptions.py +++ b/pyramid/httpexceptions.py @@ -248,10 +248,10 @@ ${body}''') comment = self.comment or '' accept_value = environ.get('HTTP_ACCEPT', '') accept = MIMEAccept(accept_value) - match = accept.best_match( - ['text/plain', - 'text/html', - 'application/json'], default_match='text/plain') + # Attempt to match text/html or application/json, if those don't + # match, we will always have our default of text/plain + match = accept.best_match(['text/html', 'application/json'], + default_match='text/plain') if match == 'text/html': self.content_type = 'text/html' -- cgit v1.2.3