From e5edb66ae81abf9a082a890ccc833332133705de Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Wed, 19 Dec 2012 11:34:30 +0100 Subject: [PATCH] Requests v1.0: Fixed request body access. --- httpie/models.py | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/httpie/models.py b/httpie/models.py index 202504fe..31a4f960 100644 --- a/httpie/models.py +++ b/httpie/models.py @@ -181,25 +181,4 @@ class HTTPRequest(HTTPMessage): @property def body(self): - """Reconstruct and return the original request body bytes.""" - if self._orig.files: - # TODO: would be nice if we didn't need to encode the files again - # FIXME: Also the boundary header doesn't match the one used. - for fn, fd in self._orig.files.values(): - # Rewind the files as they have already been read before. - fd.seek(0) - body, _ = self._orig._encode_files(self._orig.files) - else: - try: - body = self._orig.data - except AttributeError: - # requests < 0.12.1 - body = self._orig._enc_data - - if isinstance(body, dict): - body = type(self._orig)._encode_params(body) - - if isinstance(body, str): - body = body.encode('utf8') - - return body + return self._orig.body or b''