mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #987 -- Convert relative URI portions into absolute URIs in HTTP Location headers. Based on a patch from SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6164 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
dc785104b8
commit
e70d7e6064
5 changed files with 55 additions and 9 deletions
|
@ -83,9 +83,13 @@ class ClientTest(TestCase):
|
|||
def test_redirect(self):
|
||||
"GET a URL that redirects elsewhere"
|
||||
response = self.client.get('/test_client/redirect_view/')
|
||||
|
||||
# Check that the response was a 302 (redirect)
|
||||
self.assertRedirects(response, '/test_client/get_view/')
|
||||
|
||||
client_providing_host = Client(HTTP_HOST='django.testserver')
|
||||
response = client_providing_host.get('/test_client/redirect_view/')
|
||||
# Check that the response was a 302 (redirect) with absolute URI
|
||||
self.assertRedirects(response, 'http://django.testserver/test_client/get_view/')
|
||||
|
||||
def test_redirect_with_query(self):
|
||||
"GET a URL that redirects with given GET parameters"
|
||||
|
@ -97,10 +101,14 @@ class ClientTest(TestCase):
|
|||
def test_permanent_redirect(self):
|
||||
"GET a URL that redirects permanently elsewhere"
|
||||
response = self.client.get('/test_client/permanent_redirect_view/')
|
||||
|
||||
# Check that the response was a 301 (permanent redirect)
|
||||
self.assertRedirects(response, '/test_client/get_view/', status_code=301)
|
||||
|
||||
client_providing_host = Client(HTTP_HOST='django.testserver')
|
||||
response = client_providing_host.get('/test_client/permanent_redirect_view/')
|
||||
# Check that the response was a 301 (permanent redirect) with absolute URI
|
||||
self.assertRedirects(response, 'http://django.testserver/test_client/get_view/', status_code=301)
|
||||
|
||||
def test_redirect_to_strange_location(self):
|
||||
"GET a URL that redirects to a non-200 page"
|
||||
response = self.client.get('/test_client/double_redirect_view/')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue