aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShadab Zafar <dufferzafar0@gmail.com>2016-03-07 09:12:36 +0530
committerShadab Zafar <dufferzafar0@gmail.com>2016-03-11 17:57:57 +0530
commit96df077d5485979af256fe7b95708ace658fb8e2 (patch)
treec3e7634b6e1bbd2551e2fc23af19df91a92ee32f
parenta2274f52e4567de4209e3394060fe62276ad3546 (diff)
downloadmitmproxy-96df077d5485979af256fe7b95708ace658fb8e2.tar.gz
mitmproxy-96df077d5485979af256fe7b95708ace658fb8e2.tar.bz2
mitmproxy-96df077d5485979af256fe7b95708ace658fb8e2.zip
Add tests for add_header example
-rw-r--r--test/mitmproxy/test_examples.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py
index 16607a1b..8b6e0eab 100644
--- a/test/mitmproxy/test_examples.py
+++ b/test/mitmproxy/test_examples.py
@@ -7,6 +7,7 @@ from netlib.http import Headers
from . import tservers, tutils
from examples import (
+ add_header,
modify_form,
)
@@ -38,6 +39,12 @@ def test_load_scripts():
s.unload()
+def test_add_header():
+ flow = tutils.tflow(resp=netutils.tresp())
+ add_header.response({}, flow)
+ assert flow.response.headers["newheader"] == "foo"
+
+
def test_modify_form():
form_header = Headers(content_type="application/x-www-form-urlencoded")
flow = tutils.tflow(req=netutils.treq(headers=form_header))