From 2a6514eb5d9b412ba5046b08927e669edc12c271 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Tue, 24 Sep 2013 21:48:44 +0200 Subject: [PATCH] Update to requests 2.0.0 Closes #140. --- README.rst | 1 + httpie/models.py | 11 +---------- setup.py | 2 +- tests/tests.py | 4 ---- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/README.rst b/README.rst index 595e790e..3decd149 100644 --- a/README.rst +++ b/README.rst @@ -1214,6 +1214,7 @@ Changelog *You can click a version name to see a diff with the previous one.* * `0.8.0-dev`_ + * Update to Requests 2.0.0 * `0.7.0`_ (2013-09-24) * Added ``--ignore-stdin``. * Added support for auth plugins. diff --git a/httpie/models.py b/httpie/models.py index 41c4d73a..8da93c1d 100644 --- a/httpie/models.py +++ b/httpie/models.py @@ -88,16 +88,7 @@ class HTTPMessage(object): @property def content_type(self): """Return the message content type.""" - ct = self._orig.headers.get( - b'Content-Type', - self._orig.headers.get( - 'Content-Type', - '' - ) - ) - if isinstance(ct, bytes): - ct = ct.decode() - return ct + return self._orig.headers.get('Content-Type', '') class HTTPResponse(HTTPMessage): diff --git a/setup.py b/setup.py index 5ef67b4d..c94cc5d8 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ if sys.argv[-1] == 'test': requirements = [ - 'requests>=1.2.3', + 'requests>=2.0.0', 'Pygments>=1.5' ] try: diff --git a/tests/tests.py b/tests/tests.py index a269641c..dc4c959f 100755 --- a/tests/tests.py +++ b/tests/tests.py @@ -809,8 +809,6 @@ class RequestBodyFromFilePathTest(BaseTestCase): """ def test_request_body_from_file_by_path(self): - # FIXME: *sometimes* fails on py33, the content-type is form. - # https://github.com/jkbr/httpie/issues/140 r = http( '--verbose', 'POST', @@ -822,8 +820,6 @@ class RequestBodyFromFilePathTest(BaseTestCase): self.assertIn('"Content-Type": "text/plain"', r) def test_request_body_from_file_by_path_with_explicit_content_type(self): - # FIXME: *sometimes* fails on py33, the content-type is form. - # https://github.com/jkbr/httpie/issues/140 r = http( 'POST', httpbin('/post'),