1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #18456 -- Added path escaping to HttpRequest.get_full_path().

This commit is contained in:
Unai Zalakain
2014-10-31 17:43:34 +02:00
committed by Tim Graham
parent d3db878e4b
commit c548c8d0d1
6 changed files with 57 additions and 4 deletions

View File

@@ -35,6 +35,19 @@ class RequestsTests(SimpleTestCase):
# and FILES should be MultiValueDict
self.assertEqual(request.FILES.getlist('foo'), [])
def test_httprequest_full_path(self):
request = HttpRequest()
request.path = request.path_info = '/;some/?awful/=path/foo:bar/'
request.META['QUERY_STRING'] = ';some=query&+query=string'
expected = '/%3Bsome/%3Fawful/%3Dpath/foo:bar/?;some=query&+query=string'
self.assertEqual(request.get_full_path(), expected)
def test_httprequest_full_path_with_query_string_and_fragment(self):
request = HttpRequest()
request.path = request.path_info = '/foo#bar'
request.META['QUERY_STRING'] = 'baz#quux'
self.assertEqual(request.get_full_path(), '/foo%23bar?baz#quux')
def test_httprequest_repr(self):
request = HttpRequest()
request.path = '/somepath/'