summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJaap Roes <jroes@leukeleu.nl>2021-09-23 12:18:15 +0200
committerCarlton Gibson <carlton@noumenal.es>2021-09-24 08:22:28 +0200
commitb1bf8c8a4ba04049dc19217bf0e876488a4fae3c (patch)
tree60747a28b5d370e23ac9ba46c62192f1f1ece7d8 /django
parentf997c81472b96a1cf48a1a19a4fe974683455a50 (diff)
Fixed #33132 -- Fixed test client handling of querystring only redirects.
Regression in 1e5aa8e1c79252cc810af21294a6e945d11d37b3.
Diffstat (limited to 'django')
-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)