diff options
author | Ryan Petrello <lists@ryanpetrello.com> | 2014-09-23 14:01:31 -0400 |
---|---|---|
committer | Ryan Petrello <lists@ryanpetrello.com> | 2014-09-23 14:03:55 -0400 |
commit | 8d503286205cf07fad8f35cc18bc4078d57aa0e3 (patch) | |
tree | ce19862db3a3d29122b301a10a568f1c4942b987 /pecan/tests | |
parent | d4c230a2c5f9074bec40df372db18e38529c3dd2 (diff) | |
download | pecan-8d503286205cf07fad8f35cc18bc4078d57aa0e3.tar.gz |
When detecting non-content for HTTP 204, properly catch UnicodeDecodeError.
Fixes-bug: 1373003
Change-Id: I7761004c047976195a680bfb2ca23fe92516f3a6
Diffstat (limited to 'pecan/tests')
-rw-r--r-- | pecan/tests/test_base.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pecan/tests/test_base.py b/pecan/tests/test_base.py index 35f48ab..e6ddb05 100644 --- a/pecan/tests/test_base.py +++ b/pecan/tests/test_base.py @@ -68,6 +68,10 @@ class TestEmptyContent(PecanTestCase): def explicit_json_body(self): response.json_body = {'foo': 'bar'} + @expose() + def non_unicode(self): + return chr(0xc0) + return TestApp(Pecan(RootController())) def test_empty_index(self): @@ -77,6 +81,10 @@ class TestEmptyContent(PecanTestCase): self.assertEqual(r.headers['Content-Length'], '0') self.assertEqual(len(r.body), 0) + def test_index_with_non_unicode(self): + r = self.app_.get('/non_unicode/') + self.assertEqual(r.status_int, 200) + def test_explicit_body(self): r = self.app_.get('/explicit_body/') self.assertEqual(r.status_int, 200) |