aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_server.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-07-21 14:09:24 +0200
committerMaximilian Hils <git@maximilianhils.com>2014-07-21 14:09:24 +0200
commit562ac9e721c33b05e8889d4932dede794a9746a8 (patch)
tree2ce091be4429a5f54e9937866184465890538ab0 /test/test_server.py
parent7398db80db004546070139c0c7e79bba4f92b318 (diff)
downloadmitmproxy-562ac9e721c33b05e8889d4932dede794a9746a8.tar.gz
mitmproxy-562ac9e721c33b05e8889d4932dede794a9746a8.tar.bz2
mitmproxy-562ac9e721c33b05e8889d4932dede794a9746a8.zip
unify stream handling
Diffstat (limited to 'test/test_server.py')
-rw-r--r--test/test_server.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/test_server.py b/test/test_server.py
index 71f00d96..d7318849 100644
--- a/test/test_server.py
+++ b/test/test_server.py
@@ -427,16 +427,15 @@ class TestStreamRequest(tservers.HTTPProxTest):
fconn = connection.makefile()
spec = '200:h"Transfer-Encoding"="chunked":r:b"4\\r\\nthis\\r\\n7\\r\\nisatest\\r\\n0\\r\\n\\r\\n"'
connection.send("GET %s/p/%s HTTP/1.1\r\n"%(self.server.urlbase, spec))
- connection.send("\r\n");
+ connection.send("\r\n")
- httpversion, code, msg, headers, content = http.read_response(fconn, "GET", 100000, include_body=False)
+ httpversion, code, msg, headers, content = http.read_response(fconn, "GET", None, include_body=False)
assert headers["Transfer-Encoding"][0] == 'chunked'
assert code == 200
- assert http.read_next_chunk(fconn, headers, False) == "this"
- assert http.read_next_chunk(fconn, headers, False) == "isatest"
- assert http.read_next_chunk(fconn, headers, False) == None
+ chunks = list(content for _, content, _ in http.read_http_body_chunked(fconn, headers, None, "GET", 200, False))
+ assert chunks == ["this", "isatest", ""]
connection.close()