aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_http.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_http.py')
-rw-r--r--test/test_http.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/test_http.py b/test/test_http.py
index e80e4b8f..df351dc7 100644
--- a/test/test_http.py
+++ b/test/test_http.py
@@ -229,10 +229,10 @@ class TestReadResponseNoContentLength(test.ServerTestBase):
assert content == "bar\r\n\r\n"
def test_read_response():
- def tst(data, method, limit):
+ def tst(data, method, limit, include_body=True):
data = textwrap.dedent(data)
r = cStringIO.StringIO(data)
- return http.read_response(r, method, limit)
+ return http.read_response(r, method, limit, include_body=include_body)
tutils.raises("server disconnect", tst, "", "GET", None)
tutils.raises("invalid server response", tst, "foo", "GET", None)
@@ -277,6 +277,14 @@ def test_read_response():
"""
tutils.raises("invalid headers", tst, data, "GET", None)
+ data = """
+ HTTP/1.1 200 OK
+ Content-Length: 3
+
+ foo
+ """
+ assert tst(data, "GET", None, include_body=False)[4] == None
+
def test_parse_url():
assert not http.parse_url("")