From 82081c889b4ce6bcdf5701a05da6c69fd3faa000 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Thu, 29 Aug 2019 10:04:49 +0200 Subject: [PATCH] Fix ``--timeout=0`` --- httpie/client.py | 2 +- tests/test_errors.py | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/httpie/client.py b/httpie/client.py index e8a8d45c..a5ae0711 100644 --- a/httpie/client.py +++ b/httpie/client.py @@ -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, diff --git a/tests/test_errors.py b/tests/test_errors.py index c56e773b..56e61c39 100644 --- a/tests/test_errors.py +++ b/tests/test_errors.py @@ -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')