Browse files

closes GH-21: add a setter for `content` on Response

Signed-off-by: franck cuny <franck.cuny@gmail.com>
  • Loading branch information...
1 parent bd20d26 commit a71d291026bd6ac9a5f99ed0e521894ea395e98e @franckcuny committed Feb 5, 2012
Showing with 7 additions and 0 deletions.
  1. +4 −0 http/response.py
  2. +3 −0 tests/test_response.py
View
4 http/response.py
@@ -132,6 +132,10 @@ def content(self):
"""Property to get the actual content of the response"""
return self._content
+ @content.setter
+ def content(self, content):
+ self._content = content
+
def header(self, name):
"""Method to get the value for a given header"""
return self._headers.get(name)
View
3 tests/test_response.py
@@ -49,3 +49,6 @@ def test_content(self):
response = Response(status=200, message='OK',
headers={'Content-Type':'text/plain'})
self.assertTrue(response.content_is_text)
+
+ response.content = 'foo'
+ self.assertTrue(response.content, 'foo')

0 comments on commit a71d291

Please sign in to comment.