Fixed request/response session cookies.

Closes #113.
This commit is contained in:
Jakub Roztocil 2013-01-04 02:59:05 +01:00
parent 79c412064a
commit a93d57b58b
3 changed files with 7 additions and 3 deletions

View File

@ -1101,7 +1101,8 @@ Changelog
*You can click a version name to see a diff with the previous one.* *You can click a version name to see a diff with the previous one.*
* `0.4.0-alpha`_ * `0.4.0-alpha`_
* Requests v1.0.3. * Python 3.3 compatibility.
* Requests v1.0.4 compatibility.
* Added ``httpie`` management command. * Added ``httpie`` management command.
* Added support for credentials in URL. * Added support for credentials in URL.
* Added ``--no-option`` for every ``--option`` to be config-friendly. * Added ``--no-option`` for every ``--option`` to be config-friendly.

View File

@ -37,6 +37,7 @@ def get_response(name, request_kwargs, config_dir, read_only=False):
session = Session(host, name) session = Session(host, name)
session.load() session.load()
# Update session headers with the request headers. # Update session headers with the request headers.
session['headers'].update(request_kwargs.get('headers', {})) session['headers'].update(request_kwargs.get('headers', {}))
# Use the merged headers for the request # 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 request_kwargs['auth'] = session.auth
requests_session = requests.Session() requests_session = requests.Session()
requests_session.cookies = session.cookies
try: try:
response = requests_session.request(cookies=session.cookies, response = requests_session.request(**request_kwargs)
**request_kwargs)
except Exception: except Exception:
raise raise
else: else:

View File

@ -227,6 +227,8 @@ def http(*args, **kwargs):
class BaseTestCase(unittest.TestCase): class BaseTestCase(unittest.TestCase):
maxDiff = 100000
if is_py26: if is_py26:
def assertIn(self, member, container, msg=None): def assertIn(self, member, container, msg=None):
self.assertTrue(member in container, msg) self.assertTrue(member in container, msg)