# HG changeset patch # User Christophe de Vienne # Date 1406228234 -7200 # Node ID 292f786009ba1c67039fd1b770b67424a546245d # Parent 46a8ed48636f4916c2604a9d4e123dc5f69860a6 [wsgi] Re-set the request content after calling the inherited constructor. Closes #4191813 diff -r 46a8ed48636f -r 292f786009ba wsgi/request.py --- a/wsgi/request.py Thu Jul 24 20:53:21 2014 +0200 +++ b/wsgi/request.py Thu Jul 24 20:57:14 2014 +0200 @@ -66,6 +66,7 @@ super(CubicWebWsgiRequest, self).__init__(vreg, https, post, headers= headers_in) + self.content = environ['wsgi.input'] if files is not None: for key, part in files.iteritems(): name = None diff -r 46a8ed48636f -r 292f786009ba wsgi/test/unittest_wsgi.py --- a/wsgi/test/unittest_wsgi.py Thu Jul 24 20:53:21 2014 +0200 +++ b/wsgi/test/unittest_wsgi.py Thu Jul 24 20:57:14 2014 +0200 @@ -1,4 +1,5 @@ import webtest.app +from StringIO import StringIO from cubicweb.devtools.webtest import CubicWebTestTC @@ -12,3 +13,13 @@ req = CubicWebWsgiRequest(r.environ, self.vreg) self.assertEqual('text/plain', req.get_header('Content-Type')) + + def test_content_body(self): + r = webtest.app.TestRequest.blank('/', { + 'CONTENT_LENGTH': 12, + 'CONTENT_TYPE': 'text/plain', + 'wsgi.input': StringIO('some content')}) + + req = CubicWebWsgiRequest(r.environ, self.vreg) + + self.assertEqual('some content', req.content.read())