mirror of
https://github.com/httpie/cli.git
synced 2024-11-08 00:44:45 +01:00
parent
8c33e5e3d3
commit
5898879395
@ -101,6 +101,10 @@ class Session(BaseConfigDict):
|
||||
|
||||
"""
|
||||
for name, value in request_headers.items():
|
||||
|
||||
if value is None:
|
||||
continue # Ignore explicitely unset headers
|
||||
|
||||
value = value.decode('utf8')
|
||||
if name == 'User-Agent' and value.startswith('HTTPie/'):
|
||||
continue
|
||||
|
@ -2,6 +2,7 @@
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from tempfile import gettempdir
|
||||
|
||||
import pytest
|
||||
|
||||
@ -174,3 +175,14 @@ class TestSession(SessionTestBase):
|
||||
r2 = http('--session=test', httpbin.url + '/headers', env=self.env())
|
||||
assert HTTP_OK in r2
|
||||
assert r2.json['headers']['User-Agent'] == 'custom'
|
||||
|
||||
def test_download_in_session(self, httpbin):
|
||||
# https://github.com/jkbrzt/httpie/issues/412
|
||||
self.start_session(httpbin)
|
||||
cwd = os.getcwd()
|
||||
try:
|
||||
os.chdir(gettempdir())
|
||||
http('--session=test', '--download',
|
||||
httpbin.url + '/get', env=self.env())
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
|
Loading…
Reference in New Issue
Block a user