fix empty body getter bug 1067923
Change-Id: Ifd609f305ee878c39ea4e6840ed8fa9369595cfa
This commit is contained in:
parent
711df677cb
commit
b304a15b0b
|
@ -300,6 +300,8 @@ def _resp_body_property():
|
|||
"""
|
||||
def getter(self):
|
||||
if not self._body:
|
||||
if not self._app_iter:
|
||||
return ''
|
||||
self._body = ''.join(self._app_iter)
|
||||
self._app_iter = None
|
||||
return self._body
|
||||
|
|
|
@ -352,6 +352,11 @@ class TestResponse(unittest.TestCase):
|
|||
resp.content_type = None
|
||||
self.assert_('Content-Type' not in resp.headers)
|
||||
|
||||
def test_empty_body(self):
|
||||
resp = self._get_response()
|
||||
resp.body = ''
|
||||
self.assertEquals(resp.body, '')
|
||||
|
||||
def test_unicode_body(self):
|
||||
resp = self._get_response()
|
||||
resp.body = u'\N{SNOWMAN}'
|
||||
|
|
Loading…
Reference in New Issue