mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #34240 -- Preserved headers of requests made with django.test.Client in assertRedirects().
Bug in 67da22f08e.
This commit is contained in:
@@ -601,6 +601,7 @@ class AssertRedirectsTests(SimpleTestCase):
|
||||
for method in methods:
|
||||
with self.subTest(method=method):
|
||||
req_method = getattr(self.client, method)
|
||||
# HTTP_REDIRECT in "extra".
|
||||
response = req_method(
|
||||
"/redirect_based_on_extra_headers_1/",
|
||||
follow=False,
|
||||
@@ -613,6 +614,19 @@ class AssertRedirectsTests(SimpleTestCase):
|
||||
status_code=302,
|
||||
target_status_code=302,
|
||||
)
|
||||
# HTTP_REDIRECT in "headers".
|
||||
response = req_method(
|
||||
"/redirect_based_on_extra_headers_1/",
|
||||
follow=False,
|
||||
headers={"redirect": "val"},
|
||||
)
|
||||
self.assertRedirects(
|
||||
response,
|
||||
"/redirect_based_on_extra_headers_2/",
|
||||
fetch_redirect_response=True,
|
||||
status_code=302,
|
||||
target_status_code=302,
|
||||
)
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF="test_client_regress.urls")
|
||||
|
||||
Reference in New Issue
Block a user