From 1ae73b915783350105897d1d875b7b1f2979ffe0 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 3 Oct 2016 12:03:11 +1100 Subject: Add requestheaders event HTTP1 only for now, HTTP2 coming next. --- test/mitmproxy/builtins/test_script.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/mitmproxy/builtins/test_script.py b/test/mitmproxy/builtins/test_script.py index f92765ee..261adb65 100644 --- a/test/mitmproxy/builtins/test_script.py +++ b/test/mitmproxy/builtins/test_script.py @@ -175,7 +175,7 @@ class TestScriptLoader(mastertest.MasterTest): ), [f] ) evts = [i[1] for i in sc.ns.call_log] - assert evts == ['start', 'request', 'responseheaders', 'response', 'done'] + assert evts == ['start', 'requestheaders', 'request', 'responseheaders', 'response', 'done'] with m.handlecontext(): tutils.raises( -- cgit v1.2.3 From 2e48b60ff1f3271ad689ad8bc97f11b4b81ef241 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 3 Oct 2016 14:37:45 +1100 Subject: Clarify channel interaction pattern Before this patch, it wasn't clear when the arguments to an event could be modified, and when a new object should be returned. After this patch, the right thing to do is to modify the arguments in 99% of cases. The only exception to this is root_layer, for which we can find a better structure down the track. --- test/mitmproxy/test_server.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/mitmproxy/test_server.py b/test/mitmproxy/test_server.py index 059ea856..ec59fbdf 100644 --- a/test/mitmproxy/test_server.py +++ b/test/mitmproxy/test_server.py @@ -807,8 +807,7 @@ class TestStreamRequest(tservers.HTTPProxyTest): class MasterFakeResponse(tservers.TestMaster): @controller.handler def request(self, f): - resp = HTTPResponse.wrap(netlib.tutils.tresp()) - f.reply.send(resp) + f.response = HTTPResponse.wrap(netlib.tutils.tresp()) class TestFakeResponse(tservers.HTTPProxyTest): @@ -889,7 +888,7 @@ class MasterIncomplete(tservers.TestMaster): def request(self, f): resp = HTTPResponse.wrap(netlib.tutils.tresp()) resp.content = None - f.reply.send(resp) + f.response = resp class TestIncompleteResponse(tservers.HTTPProxyTest): -- cgit v1.2.3