mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
SF bug 622042: Don't expect response body from HEAD request.
Bug fix candidate.
This commit is contained in:
parent
581c36773a
commit
c1b2cb9d8f
3 changed files with 25 additions and 4 deletions
|
@ -78,4 +78,17 @@ def _test():
|
|||
if cookies != hdr:
|
||||
raise AssertionError, "multiple headers not combined properly"
|
||||
|
||||
# test that the library doesn't attempt to read any data
|
||||
# from a head request
|
||||
conn = httplib.HTTPConnection("www.python.org")
|
||||
conn.connect()
|
||||
conn.request("HEAD", "/", headers={"Connection" : "keep-alive"})
|
||||
resp = conn.getresponse()
|
||||
if resp.status != 200:
|
||||
raise AssertionError, "Expected status 200, got %d" % resp.status
|
||||
if resp.read() != "":
|
||||
raise AssertionError, "Did not expect response from HEAD request"
|
||||
resp.close()
|
||||
conn.close()
|
||||
|
||||
test()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue