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:
parent
05fc9c480a
commit
82081c889b
@ -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,
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user