diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-07-14 17:21:08 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-07-14 17:21:08 +0200 |
commit | c78b426c2a4a1980e145a94b381cb457afeddf65 (patch) | |
tree | 53d4a0e1ccce7c141f0d7bf36028a2280aa76f13 /test/test_http.py | |
parent | 4d5d8b65114d061da4f6a41673011ce643c29aab (diff) | |
parent | 273c25a705c7784ed3fbe15faa11effe05809519 (diff) | |
download | mitmproxy-c78b426c2a4a1980e145a94b381cb457afeddf65.tar.gz mitmproxy-c78b426c2a4a1980e145a94b381cb457afeddf65.tar.bz2 mitmproxy-c78b426c2a4a1980e145a94b381cb457afeddf65.zip |
Merge pull request #40 from bradleypeabody/master
added option for read_response to only read the headers
Diffstat (limited to 'test/test_http.py')
-rw-r--r-- | test/test_http.py | 12 |
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("") |