aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2017-12-20 11:53:44 +1300
committerAldo Cortesi <aldo@corte.si>2017-12-20 11:53:44 +1300
commit7d45d7f15e04ffd5dc1e593d2d3f3c4c9bfd1193 (patch)
tree82768f8291f0555d2d3c226421af9b7dcdb920bc /test
parent2fd5bbe1e7db79ba2678cbb7875825d056f55762 (diff)
downloadmitmproxy-7d45d7f15e04ffd5dc1e593d2d3f3c4c9bfd1193.tar.gz
mitmproxy-7d45d7f15e04ffd5dc1e593d2d3f3c4c9bfd1193.tar.bz2
mitmproxy-7d45d7f15e04ffd5dc1e593d2d3f3c4c9bfd1193.zip
cuts: don't crash when retrieving header of a non-existent response
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_cut.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/mitmproxy/addons/test_cut.py b/test/mitmproxy/addons/test_cut.py
index 0a523fff..71e699db 100644
--- a/test/mitmproxy/addons/test_cut.py
+++ b/test/mitmproxy/addons/test_cut.py
@@ -135,6 +135,11 @@ def test_cut():
with pytest.raises(exceptions.CommandError):
assert c.cut(tflows, ["__dict__"]) == [[""]]
+ with taddons.context():
+ tflows = [tflow.tflow(resp=False)]
+ assert c.cut(tflows, ["response.reason"]) == [[""]]
+ assert c.cut(tflows, ["response.header[key]"]) == [[""]]
+
c = cut.Cut()
with taddons.context():
tflows = [tflow.ttcpflow()]