Skip to content
Myr

Just lstrip instead of strip because trailing whitespace already works.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Hussain · committed by Hussain · parent 248d3e9 · Browse files · 2 files+3 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+3 added−3 removed

  • tests:+1 added−1 removed
  • other:+2 added−2 removed

2 files+3 added−3 removed

modified:requests/models.py+2 added-2 removed
341 unmodified lines
342 url = url.decode('utf8')343 else:344 url = unicode(url) if is_py2 else str(url)345346 # Remove leading and trailing whitespaces from url347 url = url.strip()346 # Remove leading whitespaces from url347 url = url.lstrip()348349 # Don't do any URL preparation for non-HTTP schemes like `mailto`,350 # `data` etc to work around exceptions from `url_parse`, which351 # handles RFC 3986 only.
549 unmodified lines
modified:tests/test_requests.py+1 added-1 removed
140 unmodified lines
141 assert isinstance(request.body, bytes)142143 def test_whitespaces_are_removed_from_url(self):144 # Test for issue #3696145 request = requests.Request('GET', ' http://example.com ').prepare()145 request = requests.Request('GET', ' http://example.com').prepare()146 assert request.url == 'http://example.com/'147148 @pytest.mark.parametrize('scheme', ('http://', 'HTTP://', 'hTTp://', 'HttP://'))149 def test_mixed_case_scheme_acceptable(self, httpbin, scheme):
1991 unmodified lines