summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/test/client.py2
-rw-r--r--tests/test_client_regress/tests.py7
2 files changed, 7 insertions, 2 deletions
diff --git a/django/test/client.py b/django/test/client.py
index 947a1fb56f..f4394d69f5 100644
--- a/django/test/client.py
+++ b/django/test/client.py
@@ -32,7 +32,7 @@ BOUNDARY = 'BoUnDaRyStRiNg'
MULTIPART_CONTENT = 'multipart/form-data; boundary=%s' % BOUNDARY
CONTENT_TYPE_RE = re.compile(r'.*; charset=([\w\d-]+);?')
# JSON Vendor Tree spec: https://tools.ietf.org/html/rfc6838#section-3.2
-JSON_CONTENT_TYPE_RE = re.compile(r'^application\/(vnd\..+\+)?json$')
+JSON_CONTENT_TYPE_RE = re.compile(r'^application\/(vnd\..+\+)?json')
class RedirectCycleError(Exception):
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'})