mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #32106 -- Preserved HTTP_HOST in test Client when following redirects.
Co-authored-by: David Sanders <shang.xiao.sanders@gmail.com>
This commit is contained in:
committed by
Mariusz Felisiak
parent
9b18af4f6f
commit
523fed1d2f
@@ -856,6 +856,13 @@ class ClientTest(TestCase):
|
||||
response, "https://www.djangoproject.com/", fetch_redirect_response=False
|
||||
)
|
||||
|
||||
@override_settings(ALLOWED_HOSTS=["hostname1", "hostname2"])
|
||||
def test_redirect_with_http_host(self):
|
||||
response = self.client.get(
|
||||
"/redirect_to_different_hostname/", follow=True, HTTP_HOST="hostname1"
|
||||
)
|
||||
self.assertEqual(response.content, b"hostname2")
|
||||
|
||||
def test_external_redirect_without_trailing_slash(self):
|
||||
"""
|
||||
Client._handle_redirects() with an empty path.
|
||||
|
||||
Reference in New Issue
Block a user