summaryrefslogtreecommitdiff
path: root/tests/test_client_regress
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2017-03-07 16:44:15 +0100
committerClaude Paroz <claude@2xlibre.net>2017-03-07 16:44:15 +0100
commit145f6c3ed6e8856078e2d04ff2567e9fb4a17930 (patch)
tree26a4260b8252efb99ee49cd7782b0a8d52844935 /tests/test_client_regress
parent324c4b6371cf635effd4d5ee7315c7311fbaf1b6 (diff)
downloaddjango-145f6c3ed6e8856078e2d04ff2567e9fb4a17930.tar.gz
Refs #27622 -- Fixed a regression in JSON content-type detection
A JSON Content-Type can contain further content, like charset for example.
Diffstat (limited to 'tests/test_client_regress')
-rw-r--r--tests/test_client_regress/tests.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py
index 504cb3fc94..c9dffdb35d 100644
--- a/tests/test_client_regress/tests.py
+++ b/tests/test_client_regress/tests.py
@@ -1201,7 +1201,12 @@ class RequestMethodStringDataTests(SimpleTestCase):
self.assertEqual(response.json(), {'key': 'value'})
def test_json_vendor(self):
- for content_type in ('application/vnd.api+json', 'application/vnd.api.foo+json'):
+ valid_types = (
+ 'application/vnd.api+json',
+ 'application/vnd.api.foo+json',
+ 'application/json; charset=utf-8',
+ )
+ for content_type in valid_types:
response = self.client.get('/json_response/', {'content_type': content_type})
self.assertEqual(response['Content-Type'], content_type)
self.assertEqual(response.json(), {'key': 'value'})