[Python-checkins] python/dist/src/Lib/test test_httplib.py,1.10,1.11
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
Mon, 05 May 2003 09:14:00 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv30924/Lib/test
Modified Files:
test_httplib.py
Log Message:
SF bug 622042: Don't expect response body from HEAD request.
Bug fix candidate.
Index: test_httplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_httplib.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** test_httplib.py 23 Jan 2003 18:02:18 -0000 1.10
--- test_httplib.py 5 May 2003 16:13:57 -0000 1.11
***************
*** 79,81 ****
--- 79,94 ----
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()