mirror of
https://github.com/httpie/cli.git
synced 2025-06-28 13:31:41 +02:00
parent
c3735d0422
commit
1124d68946
@ -14,6 +14,7 @@ This project adheres to `Semantic Versioning <http://semver.org/>`_.
|
|||||||
for macOS users (starting with HTTPie 0.9.4.).
|
for macOS users (starting with HTTPie 0.9.4.).
|
||||||
* Added the ability to unset a request header with ``Header:``, and send an
|
* Added the ability to unset a request header with ``Header:``, and send an
|
||||||
empty value with ``Header;``.
|
empty value with ``Header;``.
|
||||||
|
* Added ``--default-scheme <URL_SCHEME>``.
|
||||||
|
|
||||||
|
|
||||||
`0.9.4`_ (2016-07-01)
|
`0.9.4`_ (2016-07-01)
|
||||||
|
@ -313,6 +313,13 @@ this command:
|
|||||||
|
|
||||||
GET /?search=HTTPie+logo&tbm=isch HTTP/1.1
|
GET /?search=HTTPie+logo&tbm=isch HTTP/1.1
|
||||||
|
|
||||||
|
You can use the ``--default-scheme <URL_SCHEME>`` option to create
|
||||||
|
shortcuts for other protocols than HTTP:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ alias https="http --default-scheme https"
|
||||||
|
|
||||||
|
|
||||||
=============
|
=============
|
||||||
Request Items
|
Request Items
|
||||||
|
@ -614,7 +614,6 @@ troubleshooting.add_argument(
|
|||||||
)
|
)
|
||||||
troubleshooting.add_argument(
|
troubleshooting.add_argument(
|
||||||
'--default-scheme',
|
'--default-scheme',
|
||||||
choices=["http", "https"],
|
|
||||||
default="http",
|
default="http",
|
||||||
help="""
|
help="""
|
||||||
Default scheme to use if not specified in the URL.
|
Default scheme to use if not specified in the URL.
|
||||||
|
@ -28,8 +28,6 @@ URL_SCHEME_RE = re.compile(r'^[a-z][a-z0-9.+-]*://', re.IGNORECASE)
|
|||||||
|
|
||||||
HTTP_POST = 'POST'
|
HTTP_POST = 'POST'
|
||||||
HTTP_GET = 'GET'
|
HTTP_GET = 'GET'
|
||||||
HTTP = 'http://'
|
|
||||||
HTTPS = 'https://'
|
|
||||||
|
|
||||||
|
|
||||||
# Various separators used in args
|
# Various separators used in args
|
||||||
|
@ -330,8 +330,18 @@ class TestIgnoreStdin:
|
|||||||
|
|
||||||
class TestSchemes:
|
class TestSchemes:
|
||||||
|
|
||||||
def test_custom_scheme(self):
|
def test_invalid_custom_scheme(self):
|
||||||
# InvalidSchema is expected because HTTPie
|
# InvalidSchema is expected because HTTPie
|
||||||
# shouldn't touch a formally valid scheme.
|
# shouldn't touch a formally valid scheme.
|
||||||
with pytest.raises(InvalidSchema):
|
with pytest.raises(InvalidSchema):
|
||||||
http('foo+bar-BAZ.123://bah')
|
http('foo+bar-BAZ.123://bah')
|
||||||
|
|
||||||
|
def test_invalid_scheme_via_via_default_scheme(self):
|
||||||
|
# InvalidSchema is expected because HTTPie
|
||||||
|
# shouldn't touch a formally valid scheme.
|
||||||
|
with pytest.raises(InvalidSchema):
|
||||||
|
http('bah', '--default=scheme=foo+bar-BAZ.123')
|
||||||
|
|
||||||
|
def test_default_scheme(self, httpbin_secure):
|
||||||
|
url = '{0}:{1}'.format(httpbin_secure.host, httpbin_secure.port)
|
||||||
|
assert HTTP_OK in http(url, '--default-scheme=https')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user