mirror of
https://github.com/django/django.git
synced 2025-08-23 20:14:17 +00:00
[1.9.x] Fixed #26293 -- Fixed CommonMiddleware to process PREPEND_WWW and APPEND_SLASH independently.
Backport of 9390da7fb6
from master
This commit is contained in:
parent
7dee62ff68
commit
ccc367fd48
3 changed files with 15 additions and 16 deletions
|
@ -67,10 +67,8 @@ class CommonMiddlewareTest(SimpleTestCase):
|
|||
APPEND_SLASH should redirect slashless URLs to a valid pattern.
|
||||
"""
|
||||
request = self.rf.get('/slash')
|
||||
response = HttpResponseNotFound()
|
||||
r = CommonMiddleware().process_response(request, response)
|
||||
r = CommonMiddleware().process_request(request)
|
||||
self.assertEqual(r.status_code, 301)
|
||||
self.assertEqual(r.url, '/slash/')
|
||||
|
||||
@override_settings(APPEND_SLASH=True)
|
||||
def test_append_slash_redirect_querystring(self):
|
||||
|
@ -301,9 +299,6 @@ class CommonMiddlewareTest(SimpleTestCase):
|
|||
request = self.rf.get('/slash')
|
||||
request.META['QUERY_STRING'] = force_str('drink=café')
|
||||
r = CommonMiddleware().process_request(request)
|
||||
self.assertIsNone(r)
|
||||
response = HttpResponseNotFound()
|
||||
r = CommonMiddleware().process_response(request, response)
|
||||
self.assertEqual(r.status_code, 301)
|
||||
|
||||
def test_response_redirect_class(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue