summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert JW Regeer <bertjw@regeer.org>2016-04-14 01:06:35 -0600
committerBert JW Regeer <bertjw@regeer.org>2016-04-14 01:06:35 -0600
commit80f9822d85ba7e7efedff90648a336594171a3d6 (patch)
tree054f3da77373db77c4a46d9bc8578a8f6f4662b8
parentc57b44e38727af4ce93ea703dc63d65d2831ace4 (diff)
downloadpyramid-80f9822d85ba7e7efedff90648a336594171a3d6.tar.gz
pyramid-80f9822d85ba7e7efedff90648a336594171a3d6.tar.bz2
pyramid-80f9822d85ba7e7efedff90648a336594171a3d6.zip
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 */*.
-rw-r--r--pyramid/httpexceptions.py8
1 files 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'