diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2009-03-31 14:35:53 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2009-03-31 14:35:53 (GMT) |
commit | 6c5e28c383bf587f80d01e52f887801be200200d (patch) | |
tree | 6f8485b2ea4820facd7049320142e40028658494 /Lib/test | |
parent | 16caab00a259c1a01f8e47abdd321c42b1b6e554 (diff) | |
download | cpython-6c5e28c383bf587f80d01e52f887801be200200d.zip cpython-6c5e28c383bf587f80d01e52f887801be200200d.tar.gz cpython-6c5e28c383bf587f80d01e52f887801be200200d.tar.bz2 |
Simplify the Request class. The basic components of the parsed
Request are now available as public attributes, e.g. full_url and
host. The accessor methods are deprecated. The implementation
replace the complicated __getattr__ machinery with a _parse() method.
The response from an HTTP request is now an HTTPResponse instance
instead of an addinfourl() wrapper instance. The wrapper provided
minimal extract functionality and was undocumented. The API of
addinfourl() was preserved, except for close hooks, by adding a few
methods and public attributes to the HTTPResponse class.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_http_cookiejar.py | 5 | ||||
-rw-r--r-- | Lib/test/test_urllib2.py | 5 |
2 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_http_cookiejar.py b/Lib/test/test_http_cookiejar.py index a97c6fa..5ec0c25 100644 --- a/Lib/test/test_http_cookiejar.py +++ b/Lib/test/test_http_cookiejar.py @@ -583,11 +583,6 @@ class CookieTests(TestCase): req = urllib.request.Request("http://www.acme.com/", headers={"Host": "irrelevant.com"}) self.assertEquals(request_host(req), "www.acme.com") - # not actually sure this one is valid Request object, so maybe should - # remove test for no host in url in request_host function? - req = urllib.request.Request("/resource.html", - headers={"Host": "www.acme.com"}) - self.assertEquals(request_host(req), "www.acme.com") # port shouldn't be in request-host req = urllib.request.Request("http://www.acme.com:2345/resource.html", headers={"Host": "www.acme.com:5432"}) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index e590111..c8be440 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -683,8 +683,13 @@ class HandlerTests(unittest.TestCase): self.msg = msg self.status = status self.reason = reason + self.code = 200 def read(self): return '' + def info(self): + return {} + def geturl(self): + return self.url class MockHTTPClass: def __init__(self): self.level = 0 |