mirror of
https://github.com/django/django.git
synced 2025-06-14 16:09:12 +00:00
Fixed #36332 -- Corrected HttpRequest.get_full_path() and HttpRequest.get_full_path_info() examples.
This commit is contained in:
parent
f920937c8a
commit
96c79be4e4
@ -351,14 +351,14 @@ Methods
|
||||
|
||||
Returns the ``path``, plus an appended query string, if applicable.
|
||||
|
||||
Example: ``"/music/bands/the_beatles/?print=true"``
|
||||
Example: ``"/minfo/music/bands/the_beatles/?print=true"``
|
||||
|
||||
.. method:: HttpRequest.get_full_path_info()
|
||||
|
||||
Like :meth:`get_full_path`, but uses :attr:`path_info` instead of
|
||||
:attr:`path`.
|
||||
|
||||
Example: ``"/minfo/music/bands/the_beatles/?print=true"``
|
||||
Example: ``"/music/bands/the_beatles/?print=true"``
|
||||
|
||||
.. method:: HttpRequest.build_absolute_uri(location=None)
|
||||
|
||||
|
@ -53,20 +53,20 @@ class RequestsTests(SimpleTestCase):
|
||||
|
||||
def test_httprequest_full_path(self):
|
||||
request = HttpRequest()
|
||||
request.path = "/;some/?awful/=path/foo:bar/"
|
||||
request.path_info = "/prefix" + request.path
|
||||
request.path_info = "/;some/?awful/=path/foo:bar/"
|
||||
request.path = "/prefix" + request.path_info
|
||||
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)
|
||||
self.assertEqual(request.get_full_path_info(), "/prefix" + expected)
|
||||
self.assertEqual(request.get_full_path_info(), expected)
|
||||
self.assertEqual(request.get_full_path(), "/prefix" + expected)
|
||||
|
||||
def test_httprequest_full_path_with_query_string_and_fragment(self):
|
||||
request = HttpRequest()
|
||||
request.path = "/foo#bar"
|
||||
request.path_info = "/prefix" + request.path
|
||||
request.path_info = "/foo#bar"
|
||||
request.path = "/prefix" + request.path_info
|
||||
request.META["QUERY_STRING"] = "baz#quux"
|
||||
self.assertEqual(request.get_full_path(), "/foo%23bar?baz#quux")
|
||||
self.assertEqual(request.get_full_path_info(), "/prefix/foo%23bar?baz#quux")
|
||||
self.assertEqual(request.get_full_path_info(), "/foo%23bar?baz#quux")
|
||||
self.assertEqual(request.get_full_path(), "/prefix/foo%23bar?baz#quux")
|
||||
|
||||
def test_httprequest_repr(self):
|
||||
request = HttpRequest()
|
||||
|
Loading…
x
Reference in New Issue
Block a user