aboutsummaryrefslogtreecommitdiffstats
path: root/test/mitmproxy/data/addonscripts/configure.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/mitmproxy/data/addonscripts/configure.py')
-rw-r--r--test/mitmproxy/data/addonscripts/configure.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/mitmproxy/data/addonscripts/configure.py b/test/mitmproxy/data/addonscripts/configure.py
new file mode 100644
index 00000000..64abba6e
--- /dev/null
+++ b/test/mitmproxy/data/addonscripts/configure.py
@@ -0,0 +1,27 @@
+import typing
+
+from mitmproxy import ctx
+from mitmproxy import exceptions
+
+
+class TestHeader:
+ def load(self, loader):
+ loader.add_option(
+ name = "testheader",
+ typespec = typing.Optional[int],
+ default = None,
+ help = "test header",
+ )
+
+ def configure(self, updates):
+ raise exceptions.OptionsError("Options Error")
+
+ def response(self, flow):
+ if ctx.options.testheader is not None:
+ flow.response.headers["testheader"] = str(ctx.options.testheader)
+
+
+addons = [
+ TestHeader()
+]
+