From c363ca476fd378c854407fbd63d628893671027c Mon Sep 17 00:00:00 2001 From: Brendon Crawford Date: Sun, 29 Jan 2012 23:24:54 -0800 Subject: [PATCH] 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. --- requests/models.py | 3 +++ 1 file changed, 3 insertions(+) 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') -- 2.34.1