summaryrefslogtreecommitdiff
path: root/django/test
diff options
context:
space:
mode:
Diffstat (limited to 'django/test')
-rw-r--r--django/test/client.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/test/client.py b/django/test/client.py
index dd735dd833..c65e07ce7e 100644
--- a/django/test/client.py
+++ b/django/test/client.py
@@ -835,8 +835,11 @@ class Client(ClientMixin, RequestFactory):
if url.port:
extra['SERVER_PORT'] = str(url.port)
+ path = url.path
+ # RFC 2616: bare domains without path are treated as the root.
+ if not path and url.netloc:
+ path = '/'
# Prepend the request path to handle relative path redirects
- path = url.path or '/'
if not path.startswith('/'):
path = urljoin(response.request['PATH_INFO'], path)