diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 53e3c7cb..9cb4120f 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -14,6 +14,7 @@ This project adheres to `Semantic Versioning `_.
for macOS users (starting with HTTPie 0.9.4.).
* Added the ability to unset a request header with ``Header:``, and send an
empty value with ``Header;``.
+* Added ``--default-scheme ``.
`0.9.4`_ (2016-07-01)
diff --git a/README.rst b/README.rst
index 506d2115..b7a675ab 100644
--- a/README.rst
+++ b/README.rst
@@ -313,6 +313,13 @@ this command:
GET /?search=HTTPie+logo&tbm=isch HTTP/1.1
+You can use the ``--default-scheme `` option to create
+shortcuts for other protocols than HTTP:
+
+.. code-block:: bash
+
+ $ alias https="http --default-scheme https"
+
=============
Request Items
diff --git a/httpie/cli.py b/httpie/cli.py
index 2c7c92cb..cd24a3af 100644
--- a/httpie/cli.py
+++ b/httpie/cli.py
@@ -614,7 +614,6 @@ troubleshooting.add_argument(
)
troubleshooting.add_argument(
'--default-scheme',
- choices=["http", "https"],
default="http",
help="""
Default scheme to use if not specified in the URL.
diff --git a/httpie/input.py b/httpie/input.py
index e003c30d..0c8a0cef 100644
--- a/httpie/input.py
+++ b/httpie/input.py
@@ -28,8 +28,6 @@ URL_SCHEME_RE = re.compile(r'^[a-z][a-z0-9.+-]*://', re.IGNORECASE)
HTTP_POST = 'POST'
HTTP_GET = 'GET'
-HTTP = 'http://'
-HTTPS = 'https://'
# Various separators used in args
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 831d04ea..c9746ae2 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -330,8 +330,18 @@ class TestIgnoreStdin:
class TestSchemes:
- def test_custom_scheme(self):
+ def test_invalid_custom_scheme(self):
# InvalidSchema is expected because HTTPie
# shouldn't touch a formally valid scheme.
with pytest.raises(InvalidSchema):
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')