1
0
mirror of https://github.com/httpie/cli.git synced 2024-11-28 08:38:44 +02:00

Fix `--timeout=0`

This commit is contained in:
Jakub Roztocil 2019-08-29 10:04:49 +02:00
parent 05fc9c480a
commit 82081c889b
2 changed files with 1 additions and 15 deletions

View File

@ -180,7 +180,7 @@ def get_requests_kwargs(args, base_headers=None):
'false': False,
}.get(args.verify.lower(), args.verify),
'cert': cert,
'timeout': args.timeout,
'timeout': args.timeout or None,
'auth': args.auth,
'proxies': {p.key: p.value for p in args.proxy},
'files': args.files,

View File

@ -37,20 +37,6 @@ def test_error_traceback(get_response):
main(['--ignore-stdin', '--traceback', 'www.google.com'])
@mock.patch('httpie.core.get_response')
def test_timeout(get_response):
def error(msg, *args, **kwargs):
global error_msg
error_msg = msg % args
exc = Timeout('Request timed out')
exc.request = Request(method='GET', url='http://www.google.com')
get_response.side_effect = exc
ret = main(['--ignore-stdin', 'www.google.com'], custom_log_error=error)
assert ret == ExitStatus.ERROR_TIMEOUT
assert error_msg == 'Request timed out (30s).'
def test_max_headers_limit(httpbin_both):
with raises(ConnectionError) as e:
http('--max-headers=1', httpbin_both + '/get')