diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_protocol_http.py | 4 | ||||
-rw-r--r-- | test/test_proxy.py | 4 | ||||
-rw-r--r-- | test/test_server.py | 12 |
3 files changed, 12 insertions, 8 deletions
diff --git a/test/test_protocol_http.py b/test/test_protocol_http.py index d8489d4d..747fdc1e 100644 --- a/test/test_protocol_http.py +++ b/test/test_protocol_http.py @@ -327,11 +327,11 @@ class TestInvalidRequests(tservers.HTTPProxTest): p = self.pathoc() r = p.request("connect:'%s:%s'" % ("127.0.0.1", self.server2.port)) assert r.status_code == 400 - assert "Must not CONNECT on already encrypted connection" in r.content + assert "Must not CONNECT on already encrypted connection" in r.body def test_relative_request(self): p = self.pathoc_raw() p.connect() r = p.request("get:/p/200") assert r.status_code == 400 - assert "Invalid HTTP request form" in r.content + assert "Invalid HTTP request form" in r.body diff --git a/test/test_proxy.py b/test/test_proxy.py index 5a3bb1ab..01fbe953 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -31,7 +31,9 @@ class TestServerConnection: f.server_conn = sc f.request.path = "/p/200:da" sc.send(f.request.assemble()) - assert http.http1.read_response(sc.rfile, f.request.method, 1000) + + protocol = http.http1.HTTP1Protocol(rfile=sc.rfile) + assert protocol.read_response(f.request.method, 1000) assert self.d.last_log() sc.finish() diff --git a/test/test_server.py b/test/test_server.py index 8d773957..10822ae4 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -184,6 +184,9 @@ class TcpMixin: class AppMixin: def test_app(self): ret = self.app("/") + print(ret) + print(ret.status_code) + print(ret.content) assert ret.status_code == 200 assert "mitmproxy" in ret.content @@ -767,16 +770,15 @@ class TestStreamRequest(tservers.HTTPProxTest): (self.server.urlbase, spec)) connection.send("\r\n") - resp = http.http1.read_response(fconn, "GET", None, include_body=False) + protocol = http.http1.HTTP1Protocol(rfile=fconn) + resp = protocol.read_response("GET", None, include_body=False) assert resp.headers["Transfer-Encoding"][0] == 'chunked' assert resp.status_code == 200 chunks = list( - content for _, - content, - _ in http.http1.read_http_body_chunked( - fconn, resp.headers, None, "GET", 200, False)) + content for _, content, _ in protocol.read_http_body_chunked( + resp.headers, None, "GET", 200, False)) assert chunks == ["this", "isatest", ""] connection.close() |