mirror of
https://github.com/django/django.git
synced 2025-11-01 20:31:40 +00:00
Added a 'permanent' argument the simple.redirect_to() generic view. It's True by default, to match existing behavior. If set to False, the redirect will be a 302 instead of a 301. This is technically backwards-incompatible if you were using the redirect_to generic view with a format-string key called 'permanent', which is highly, highly unlikely.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9594 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e9b90d9899
commit
b76d7c1dec
4 changed files with 31 additions and 5 deletions
|
|
@ -118,6 +118,12 @@ class ClientTest(TestCase):
|
|||
# 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_temporary_redirect(self):
|
||||
"GET a URL that does a non-permanent redirect"
|
||||
response = self.client.get('/test_client/temporary_redirect_view/')
|
||||
# Check that the response was a 302 (non-permanent redirect)
|
||||
self.assertRedirects(response, 'http://testserver/test_client/get_view/', status_code=302)
|
||||
|
||||
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