You've already forked httpie-cli
mirror of
https://github.com/httpie/cli.git
synced 2025-08-10 22:42:05 +02:00
Reintroduce $ https
command alias with https://
as default scheme
Close #608
This commit is contained in:
@@ -342,6 +342,10 @@ class TestSchemes:
|
||||
with pytest.raises(InvalidSchema):
|
||||
http('bah', '--default=scheme=foo+bar-BAZ.123')
|
||||
|
||||
def test_default_scheme(self, httpbin_secure):
|
||||
def test_default_scheme_option(self, httpbin_secure):
|
||||
url = '{0}:{1}'.format(httpbin_secure.host, httpbin_secure.port)
|
||||
assert HTTP_OK in http(url, '--default-scheme=https')
|
||||
|
||||
def test_scheme_when_invoked_as_https(self, httpbin_secure):
|
||||
url = '{0}:{1}'.format(httpbin_secure.host, httpbin_secure.port)
|
||||
assert HTTP_OK in http(url, program_name='https')
|
||||
|
@@ -20,7 +20,7 @@ def test_error(get_response):
|
||||
exc = ConnectionError('Connection aborted')
|
||||
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)
|
||||
ret = main(['http', '--ignore-stdin', 'www.google.com'], custom_log_error=error)
|
||||
assert ret == ExitStatus.ERROR
|
||||
assert error_msg == (
|
||||
'ConnectionError: '
|
||||
@@ -34,7 +34,7 @@ def test_error_traceback(get_response):
|
||||
exc.request = Request(method='GET', url='http://www.google.com')
|
||||
get_response.side_effect = exc
|
||||
with raises(ConnectionError):
|
||||
main(['--ignore-stdin', '--traceback', 'www.google.com'])
|
||||
main(['http', '--ignore-stdin', '--traceback', 'www.google.com'])
|
||||
|
||||
|
||||
def test_max_headers_limit(httpbin_both):
|
||||
|
@@ -140,7 +140,7 @@ class ExitStatusError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def http(*args, **kwargs):
|
||||
def http(*args, program_name='http', **kwargs):
|
||||
# noinspection PyUnresolvedReferences
|
||||
"""
|
||||
Run HTTPie and capture stderr/out and exit status.
|
||||
@@ -197,7 +197,8 @@ def http(*args, **kwargs):
|
||||
add_to_args.append('--traceback')
|
||||
if not any('--timeout' in arg for arg in args_with_config_defaults):
|
||||
add_to_args.append('--timeout=3')
|
||||
args = add_to_args + args
|
||||
|
||||
complete_args = [program_name, *add_to_args, *args]
|
||||
|
||||
def dump_stderr():
|
||||
stderr.seek(0)
|
||||
@@ -205,7 +206,7 @@ def http(*args, **kwargs):
|
||||
|
||||
try:
|
||||
try:
|
||||
exit_status = main(args=args, **kwargs)
|
||||
exit_status = main(args=complete_args, **kwargs)
|
||||
if '--download' in args:
|
||||
# Let the progress reporter thread finish.
|
||||
time.sleep(.5)
|
||||
|
Reference in New Issue
Block a user