aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-10-03 14:37:45 +1100
committerAldo Cortesi <aldo@nullcube.com>2016-10-04 08:13:56 +1100
commit2e48b60ff1f3271ad689ad8bc97f11b4b81ef241 (patch)
tree86409bd6a66224bab1cc70b51b1c4975f8f19182 /test
parent8cec187f9a606eba362b437eeab407cefe8600c6 (diff)
downloadmitmproxy-2e48b60ff1f3271ad689ad8bc97f11b4b81ef241.tar.gz
mitmproxy-2e48b60ff1f3271ad689ad8bc97f11b4b81ef241.tar.bz2
mitmproxy-2e48b60ff1f3271ad689ad8bc97f11b4b81ef241.zip
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.
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_server.py5
1 files changed, 2 insertions, 3 deletions
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):