mirror of
https://github.com/httpie/cli.git
synced 2024-11-28 08:38:44 +02:00
parent
0f96348fd1
commit
ca36f1de04
@ -1272,10 +1272,11 @@ Changelog
|
||||
* Added ``--cert`` and ``--certkey`` parameters to specify a client side
|
||||
certificate and private key for SSL
|
||||
* Improved unicode support.
|
||||
* Fixed ``User-Agent`` overwriting when used within a session.
|
||||
* Switched from ``unittest`` to ``pytest``.
|
||||
* Various test suite improvements.
|
||||
* Added `CONTRIBUTING`_.
|
||||
* Fixed ``User-Agent`` overwriting when used within a session.
|
||||
* Fixed handling of empty passwords in URL credentials.
|
||||
* `0.8.0`_ (2014-01-25)
|
||||
* Added ``field=@file.txt`` and ``field:=@file.json`` for embedding
|
||||
the contents of text and JSON files into request data.
|
||||
|
@ -211,7 +211,8 @@ class Parser(ArgumentParser):
|
||||
|
||||
elif url.username is not None:
|
||||
# Handle http://username:password@hostname/
|
||||
username, password = url.username, url.password
|
||||
username = url.username
|
||||
password = url.password or ''
|
||||
self.args.auth = AuthCredentials(
|
||||
key=username,
|
||||
value=password,
|
||||
|
@ -2,8 +2,9 @@
|
||||
import requests
|
||||
import pytest
|
||||
|
||||
from utils import http, add_auth, HTTP_OK
|
||||
from utils import http, add_auth, HTTP_OK, TestEnvironment
|
||||
import httpie.input
|
||||
import httpie.cli
|
||||
|
||||
|
||||
class TestAuth:
|
||||
@ -44,3 +45,18 @@ class TestAuth:
|
||||
r = http('--auth=user:password', 'GET', url)
|
||||
assert HTTP_OK in r
|
||||
assert r.json == {'authenticated': True, 'user': 'user'}
|
||||
|
||||
@pytest.mark.parametrize('url', [
|
||||
'username@example.org',
|
||||
'username:@example.org',
|
||||
])
|
||||
def test_only_username_in_url(self, url):
|
||||
"""
|
||||
https://github.com/jakubroztocil/httpie/issues/242
|
||||
|
||||
"""
|
||||
args = httpie.cli.parser.parse_args(args=[url], env=TestEnvironment())
|
||||
assert args.auth
|
||||
assert args.auth.key == 'username'
|
||||
assert args.auth.value == ''
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user