summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Lange <jml@mumak.net>2015-12-16 10:50:50 +0000
committerJonathan Lange <jml@mumak.net>2015-12-16 10:50:50 +0000
commit85f9cde25777b07028c146f681204b81ae61adc4 (patch)
tree13d228c662bc90577b59faa4f8ef14bde0e7e5cc
parentc7b4fe3b6a0d699a41829bf4ebdfd1e9639f6f42 (diff)
downloadtesttools-json-text.tar.gz
Set JSON charsetjson-text
-rw-r--r--testtools/content_type.py3
-rw-r--r--testtools/tests/test_content_type.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/testtools/content_type.py b/testtools/content_type.py
index c37e385..a08ef31 100644
--- a/testtools/content_type.py
+++ b/testtools/content_type.py
@@ -42,6 +42,7 @@ class ContentType(object):
return self.type == 'text' or self._text_override
-JSON = ContentType('application', 'json', text_override=True)
+JSON = ContentType(
+ 'application', 'json', {'charset': 'utf8'}, text_override=True)
UTF8_TEXT = ContentType('text', 'plain', {'charset': 'utf8'})
diff --git a/testtools/tests/test_content_type.py b/testtools/tests/test_content_type.py
index df149c9..f81718b 100644
--- a/testtools/tests/test_content_type.py
+++ b/testtools/tests/test_content_type.py
@@ -64,7 +64,7 @@ class TestBuiltinContentTypes(TestCase):
# The JSON content type represents implictly UTF-8 application/json.
self.assertThat(JSON.type, Equals('application'))
self.assertThat(JSON.subtype, Equals('json'))
- self.assertThat(JSON.parameters, Equals({}))
+ self.assertThat(JSON.parameters, Equals({'charset': 'utf8'}))
self.assertThat(JSON.is_text(), Equals(True))