diff options
-rw-r--r-- | pecan/core.py | 8 | ||||
-rw-r--r-- | pecan/tests/test_base.py | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/pecan/core.py b/pecan/core.py index 5804e19..76fc975 100644 --- a/pecan/core.py +++ b/pecan/core.py @@ -552,10 +552,12 @@ class Pecan(object): elif result: resp.body = result elif response.status_int == 200: - response.status = 204 + resp.status = 204 - # set the content type - if pecan_state['content_type']: + if resp.status_int in (204, 304): + resp.content_type = None + elif pecan_state['content_type']: + # set the content type resp.content_type = pecan_state['content_type'] def __call__(self, environ, start_response): diff --git a/pecan/tests/test_base.py b/pecan/tests/test_base.py index 96f7757..050ac6d 100644 --- a/pecan/tests/test_base.py +++ b/pecan/tests/test_base.py @@ -47,6 +47,7 @@ class TestEmptyContent(PecanTestCase): def test_empty_index(self): r = self.app_.get('/') self.assertEqual(r.status_int, 204) + self.assertNotIn('Content-Type', r.headers) self.assertEqual(r.headers['Content-Length'], '0') self.assertEqual(len(r.body), 0) |