mirror of
https://github.com/httpie/cli.git
synced 2025-08-14 23:22:43 +02:00
Fix handling of session files with Cookie:
followed by other headers (#1127)
* Fix the handling of cookies from session files * Apply suggestions from code review Co-authored-by: Jakub Roztocil <jakub@roztocil.co> * Fix test docstring formatting Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
This commit is contained in:
committed by
GitHub
parent
54c8612452
commit
d7caeaf372
@ -178,6 +178,24 @@ class TestSession(SessionTestBase):
|
||||
assert HTTP_OK in r2
|
||||
assert r2.json['headers']['Foo'] == 'Bar'
|
||||
|
||||
def test_session_with_cookie_followed_by_another_header(self, httpbin):
|
||||
"""
|
||||
Make sure headers don’t get mutated — <https://github.com/httpie/httpie/issues/1126>
|
||||
"""
|
||||
self.start_session(httpbin)
|
||||
session_data = {
|
||||
"headers": {
|
||||
"cookie": "...",
|
||||
"zzz": "..."
|
||||
}
|
||||
}
|
||||
session_path = self.config_dir / 'session-data.json'
|
||||
session_path.write_text(json.dumps(session_data))
|
||||
r = http('--session', str(session_path), 'GET', httpbin.url + '/get',
|
||||
env=self.env())
|
||||
assert HTTP_OK in r
|
||||
assert 'Zzz' in r
|
||||
|
||||
def test_session_unicode(self, httpbin):
|
||||
self.start_session(httpbin)
|
||||
|
||||
|
Reference in New Issue
Block a user