From b1bf8c8a4ba04049dc19217bf0e876488a4fae3c Mon Sep 17 00:00:00 2001 From: Jaap Roes Date: Thu, 23 Sep 2021 12:18:15 +0200 Subject: Fixed #33132 -- Fixed test client handling of querystring only redirects. Regression in 1e5aa8e1c79252cc810af21294a6e945d11d37b3. --- tests/test_client/views.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/test_client/views.py') diff --git a/tests/test_client/views.py b/tests/test_client/views.py index 692581e892..fa2bac2943 100644 --- a/tests/test_client/views.py +++ b/tests/test_client/views.py @@ -85,6 +85,21 @@ def post_view(request): return HttpResponse(t.render(c)) +def post_then_get_view(request): + """ + A view that expects a POST request, returns a redirect response + to itself providing only a ?success=true querystring, + the value of this querystring is then rendered upon GET. + """ + if request.method == 'POST': + return HttpResponseRedirect('?success=true') + + t = Template('The value of success is {{ value }}.', name='GET Template') + c = Context({'value': request.GET.get('success', 'false')}) + + return HttpResponse(t.render(c)) + + def json_view(request): """ A view that expects a request with the header 'application/json' and JSON -- cgit v1.2.1