Skip to content

Commit 6c95af5

Browse files
authored
Fixed #36966 -- Fixed ValueError when query_params and follow are used on test client.
1 parent e0fd41c commit 6c95af5

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

django/test/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,7 @@ def _follow_redirect(
998998
request_method = self.get
999999
data = QueryDict(url.query)
10001000
content_type = None
1001+
query_params = None
10011002

10021003
return request_method(
10031004
path,

tests/test_client/tests.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,13 @@ def test_cannot_use_data_and_query_params_together(self):
10531053
query_params={"q": "terms"},
10541054
)
10551055

1056+
def test_follow_redirect_with_query_params(self):
1057+
response = self.client.get(
1058+
"/redirect_view/", query_params={"next": "x"}, follow=True
1059+
)
1060+
self.assertEqual(response.status_code, 200)
1061+
self.assertEqual(response.wsgi_request.get_full_path(), "/get_view/?next=x")
1062+
10561063

10571064
@override_settings(
10581065
MIDDLEWARE=["django.middleware.csrf.CsrfViewMiddleware"],

0 commit comments

Comments
 (0)