mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Fix Issue8280 - urllib2's Request method will remove fragements in the url.
This is how it should work,wget and curl work like this way too. Old behavior was wrong.
This commit is contained in:
parent
ad537f23e2
commit
d95cc75483
3 changed files with 19 additions and 1 deletions
|
@ -1249,6 +1249,16 @@ class RequestTests(unittest.TestCase):
|
|||
self.assertEqual("www.python.org", self.get.get_origin_req_host())
|
||||
self.assertEqual("www.perl.org", self.get.get_host())
|
||||
|
||||
def test_wrapped_url(self):
|
||||
req = Request("<URL:http://www.python.org>")
|
||||
self.assertEqual("www.python.org", req.get_host())
|
||||
|
||||
def test_urlwith_fragment(self):
|
||||
req = Request("http://www.python.org/?qs=query#fragment=true")
|
||||
self.assertEqual("/?qs=query", req.get_selector())
|
||||
req = Request("http://www.python.org/#fun=true")
|
||||
self.assertEqual("/", req.get_selector())
|
||||
|
||||
|
||||
def test_main(verbose=None):
|
||||
from test import test_urllib2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue