Add a trailing slash for twitter.com
authorKenneth Reitz <me@kennethreitz.com>
Tue, 4 Oct 2011 15:33:11 +0000 (11:33 -0400)
committerKenneth Reitz <me@kennethreitz.com>
Tue, 4 Oct 2011 15:33:11 +0000 (11:33 -0400)
requests/utils.py

index 0a114768b19545eb6c30407b06330cb32b4b9358..832a11f3524ea31d2b1d5576c268025ba2ffda4f 100644 (file)
@@ -54,6 +54,10 @@ def cleanup_url(url, parent_url=None):
     if netloc:
         netloc = netloc.encode('idna')
 
+    # Add a trailing slash to root domain reqests.
+    if not len(path):
+        path = '/'
+
     if isinstance(path, unicode):
         path = path.encode('utf-8')