mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Just lstrip instead of strip because trailing whitespace already works.
This commit is contained in:
+2
-2
@@ -343,8 +343,8 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
|
||||
else:
|
||||
url = unicode(url) if is_py2 else str(url)
|
||||
|
||||
# Remove leading and trailing whitespaces from url
|
||||
url = url.strip()
|
||||
# Remove leading whitespaces from url
|
||||
url = url.lstrip()
|
||||
|
||||
# Don't do any URL preparation for non-HTTP schemes like `mailto`,
|
||||
# `data` etc to work around exceptions from `url_parse`, which
|
||||
|
||||
@@ -142,7 +142,7 @@ class TestRequests:
|
||||
|
||||
def test_whitespaces_are_removed_from_url(self):
|
||||
# Test for issue #3696
|
||||
request = requests.Request('GET', ' http://example.com ').prepare()
|
||||
request = requests.Request('GET', ' http://example.com').prepare()
|
||||
assert request.url == 'http://example.com/'
|
||||
|
||||
@pytest.mark.parametrize('scheme', ('http://', 'HTTP://', 'hTTp://', 'HttP://'))
|
||||
|
||||
Reference in New Issue
Block a user