Added a short timeout for test requests

This commit is contained in:
Jakub Roztocil 2016-03-02 00:31:00 +08:00
parent 20f01709ea
commit d4067fcb6d
2 changed files with 12 additions and 5 deletions

View File

@ -287,9 +287,11 @@ If the port is omitted, then port 80 is assumed.
If you find yourself manually constructing URLs with **querystring parameters** If you find yourself manually constructing URLs with **querystring parameters**
on the terminal, you may appreciate the ``param==value`` syntax for appending on the terminal, you may appreciate the ``param==value`` syntax for appending
URL parameters so that you don't have to worry about escaping the ``&`` URL parameters. With that, you don't have to worry about escaping the ``&``
separators and as well as special character in parameter values. separators for you shell. Also, special characters in parameter values,
To search for ``HTTPie logo`` on Google Images you could use this command: will also automatically escaped (HTTPie otherwise expects the URL to be
already escaped). To search for ``HTTPie logo`` on Google Images you could use
this command:
.. code-block:: bash .. code-block:: bash

View File

@ -185,8 +185,13 @@ def http(*args, **kwargs):
stderr = env.stderr stderr = env.stderr
args = list(args) args = list(args)
if '--debug' not in args and '--traceback' not in args: extra_args = []
args = ['--traceback'] + args if '--debug' not in args:
if '--traceback' not in args:
extra_args.append('--traceback')
if '--timeout' not in ' '.join(args):
extra_args.append('--timeout=3')
args = extra_args + args
def dump_stderr(): def dump_stderr():
stderr.seek(0) stderr.seek(0)