From a93d57b58bf060dad8fa9f762c3e7a9be20869e0 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Fri, 4 Jan 2013 02:59:05 +0100 Subject: [PATCH] Fixed request/response session cookies. Closes #113. --- README.rst | 3 ++- httpie/sessions.py | 5 +++-- tests/tests.py | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 84e91faa..3745d0cc 100644 --- a/README.rst +++ b/README.rst @@ -1101,7 +1101,8 @@ Changelog *You can click a version name to see a diff with the previous one.* * `0.4.0-alpha`_ - * Requests v1.0.3. + * Python 3.3 compatibility. + * Requests v1.0.4 compatibility. * Added ``httpie`` management command. * Added support for credentials in URL. * Added ``--no-option`` for every ``--option`` to be config-friendly. diff --git a/httpie/sessions.py b/httpie/sessions.py index 0ac32912..938c45c8 100644 --- a/httpie/sessions.py +++ b/httpie/sessions.py @@ -37,6 +37,7 @@ def get_response(name, request_kwargs, config_dir, read_only=False): session = Session(host, name) session.load() + # Update session headers with the request headers. session['headers'].update(request_kwargs.get('headers', {})) # Use the merged headers for the request @@ -49,10 +50,10 @@ def get_response(name, request_kwargs, config_dir, read_only=False): request_kwargs['auth'] = session.auth requests_session = requests.Session() + requests_session.cookies = session.cookies try: - response = requests_session.request(cookies=session.cookies, - **request_kwargs) + response = requests_session.request(**request_kwargs) except Exception: raise else: diff --git a/tests/tests.py b/tests/tests.py index f7ab32a6..a8e6cc04 100755 --- a/tests/tests.py +++ b/tests/tests.py @@ -227,6 +227,8 @@ def http(*args, **kwargs): class BaseTestCase(unittest.TestCase): + maxDiff = 100000 + if is_py26: def assertIn(self, member, container, msg=None): self.assertTrue(member in container, msg)