diff --git a/swift/common/swob.py b/swift/common/swob.py index d30cbb8754..a6005e78cc 100755 --- a/swift/common/swob.py +++ b/swift/common/swob.py @@ -944,14 +944,14 @@ class Response(object): _body_slicer) if app_iter: return app_iter - if body: + if body is not None: return [body] if self.status_int in RESPONSE_REASONS: title, exp = RESPONSE_REASONS[self.status_int] + self.content_type = 'text/html; charset=UTF-8' if exp: body = '

%s

%s

' % (title, exp) self.content_length = len(body) - self.content_type = 'text/html' return [body] return [''] diff --git a/test/unit/common/test_swob.py b/test/unit/common/test_swob.py index 587d7bec78..ab884d5cfe 100755 --- a/test/unit/common/test_swob.py +++ b/test/unit/common/test_swob.py @@ -397,7 +397,7 @@ class TestStatusMap(unittest.TestCase): self.assert_('The resource could not be found.' in body) self.assertEquals(response_args[0], '404 Not Found') headers = dict(response_args[1]) - self.assertEquals(headers['content-type'], 'text/html') + self.assertEquals(headers['content-type'], 'text/html; charset=UTF-8') self.assert_(int(headers['content-length']) > 0)