mirror of
https://github.com/httpie/cli.git
synced 2025-06-26 12:31:47 +02:00
parent
8c33e5e3d3
commit
5898879395
@ -101,6 +101,10 @@ class Session(BaseConfigDict):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
for name, value in request_headers.items():
|
for name, value in request_headers.items():
|
||||||
|
|
||||||
|
if value is None:
|
||||||
|
continue # Ignore explicitely unset headers
|
||||||
|
|
||||||
value = value.decode('utf8')
|
value = value.decode('utf8')
|
||||||
if name == 'User-Agent' and value.startswith('HTTPie/'):
|
if name == 'User-Agent' and value.startswith('HTTPie/'):
|
||||||
continue
|
continue
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
from tempfile import gettempdir
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -174,3 +175,14 @@ class TestSession(SessionTestBase):
|
|||||||
r2 = http('--session=test', httpbin.url + '/headers', env=self.env())
|
r2 = http('--session=test', httpbin.url + '/headers', env=self.env())
|
||||||
assert HTTP_OK in r2
|
assert HTTP_OK in r2
|
||||||
assert r2.json['headers']['User-Agent'] == 'custom'
|
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…
x
Reference in New Issue
Block a user