From: Brendon Crawford Date: Mon, 30 Jan 2012 07:24:54 +0000 (-0800) Subject: Added ability to check if missing trailing slash in path. X-Git-Tag: v0.10.2~33^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c363ca476fd378c854407fbd63d628893671027c;p=services%2Fpython-requests.git 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. --- diff --git a/requests/models.py b/requests/models.py index 7ac85cc..6fdf8bb 100644 --- a/requests/models.py +++ b/requests/models.py @@ -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')