mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Added ability to check if missing trailing slash in path.
Previously this URL would not work:
http://example.com?foo=bar
But this URL would work:
http://example.com/?foo=bar
Even though a slash is required for a valid URL, it is a common use case
for the slash to be left out, so it would be a good idea to account for this.
This commit is contained in:
@@ -317,6 +317,9 @@ class Request(object):
|
||||
|
||||
netloc = netloc.encode('idna').decode('utf-8')
|
||||
|
||||
if not path:
|
||||
path = '/'
|
||||
|
||||
if is_py2:
|
||||
if isinstance(path, str):
|
||||
path = path.encode('utf-8')
|
||||
|
||||
Reference in New Issue
Block a user