From ca58a405fca0ddc5ce2cb3d022dec403df1a5031 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Tue, 7 Mar 2017 16:44:15 +0100 Subject: [1.11.x] Refs #27622 -- Fixed a regression in JSON content-type detection A JSON Content-Type can contain further content, like charset for example. Backport of 145f6c3ed6e8856078e2d04ff2567e9fb4a17930 from master. --- tests/test_client_regress/tests.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py index c21fd8651f..9ed2741f47 100644 --- a/tests/test_client_regress/tests.py +++ b/tests/test_client_regress/tests.py @@ -1219,7 +1219,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'}) -- cgit v1.3