Ticket #371: ticket_371_webob.patch
| File ticket_371_webob.patch, 1.2 KB (added by greut, 3 years ago) |
|---|
-
tests/test_response.py
42 42 req = Request.blank('/') 43 43 req.method = 'HEAD' 44 44 app_iter = StringIO('foo') 45 res = req.get_response(Response(app_iter=app_iter)) 45 res = req.get_response(Response(app_iter=app_iter, 46 headerlist=[('Content-Length', '42')])) 46 47 assert res.status_int == 200 47 48 assert res.body == '' 49 assert res.headers['Content-Length'] == '42' 48 50 assert app_iter.closed -
webob/__init__.py
1829 1840 if hasattr(self._app_iter, 'close'): 1830 1841 self._app_iter.close() 1831 1842 self._app_iter = None 1832 self.content_length = len(self._body) 1843 if not(self._request) or self._request.method <> 'HEAD': 1844 self.content_length = len(self._body) 1833 1845 return self._body 1834 1846 1835 1847 def _body__set(self, value):
