Skip to content

Commit

Permalink
[#1536] Enhancement: Add shortcut for --verify=no.
Browse files Browse the repository at this point in the history
  • Loading branch information
HackTheOxidation committed Nov 25, 2023
1 parent 9e8e369 commit 51606bf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions httpie/cli/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ def format_auth_help(auth_plugins_mapping, *, isolation_mode: bool = False):

ssl.add_argument(
'--verify',
dest='verify',
default='yes',
short_help='If "no", skip SSL verification. If a file path, use it as a CA bundle.',
help="""
Expand All @@ -820,6 +821,16 @@ def format_auth_help(auth_plugins_mapping, *, isolation_mode: bool = False):
variable instead.)
""",
)
ssl.add_argument(
'-k',
dest='verify',
default='no',
short_help='Shortcut for "--verify=no" skipping SSL verification',
help="""
Shortcut for "--verify=no" which skips verification of the host's
SSL certificate. See the '--verify' flag help for further information.
""",
)
ssl.add_argument(
'--ssl',
dest='ssl_version',
Expand Down
5 changes: 5 additions & 0 deletions tests/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ def test_verify_no_OK(self, httpbin_secure):
r = http(httpbin_secure.url + '/get', '--verify=no')
assert HTTP_OK in r

def test_verify_no_shortcut_OK(self, httpbin_secure):
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
r = http(httpbin_secure.url + '/get', '-k')
assert HTTP_OK in r

@pytest.mark.parametrize('verify_value', ['false', 'fALse'])
def test_verify_false_OK(self, httpbin_secure, verify_value):
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
Expand Down

0 comments on commit 51606bf

Please sign in to comment.