aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests/accept.py
diff options
context:
space:
mode:
authorTom Christie2012-08-24 16:06:23 +0100
committerTom Christie2012-08-24 16:06:23 +0100
commit7557777c668e6b8eaa85b07971b94115a33c9358 (patch)
tree6bd152248eb1e535b86fbc4396fe16fa644a0d2f /djangorestframework/tests/accept.py
parent2d2e2f95b0268c3282edfca5c047bdc831133016 (diff)
parentdb7d15d5d136a9b4dcf759f9d588006244bd4e91 (diff)
downloaddjango-rest-framework-7557777c668e6b8eaa85b07971b94115a33c9358.tar.bz2
Merge branch 'master' of https://github.com/tomchristie/django-rest-framework
Diffstat (limited to 'djangorestframework/tests/accept.py')
-rw-r--r--djangorestframework/tests/accept.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/djangorestframework/tests/accept.py b/djangorestframework/tests/accept.py
index 21aba589..7f4eb320 100644
--- a/djangorestframework/tests/accept.py
+++ b/djangorestframework/tests/accept.py
@@ -50,6 +50,16 @@ class UserAgentMungingTest(TestCase):
resp = self.view(req)
self.assertEqual(resp['Content-Type'], 'text/html')
+ def test_dont_munge_msie_with_x_requested_with_header(self):
+ """Send MSIE user agent strings, and an X-Requested-With header, and
+ ensure that we get a JSON response if we set a */* Accept header."""
+ for user_agent in (MSIE_9_USER_AGENT,
+ MSIE_8_USER_AGENT,
+ MSIE_7_USER_AGENT):
+ req = self.req.get('/', HTTP_ACCEPT='*/*', HTTP_USER_AGENT=user_agent, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
+ resp = self.view(req)
+ self.assertEqual(resp['Content-Type'], 'application/json')
+
def test_dont_rewrite_msie_accept_header(self):
"""Turn off _IGNORE_IE_ACCEPT_HEADER, send MSIE user agent strings and ensure
that we get a JSON response if we set a */* accept header."""