This commit is contained in:
root 2020-03-31 10:07:53 +05:30
parent 61617919ff
commit 79b8fcc052

View File

@ -1,27 +1,21 @@
import typing import typing
from mitmproxy import ctx
from mitmproxy import exceptions from mitmproxy import exceptions
class TestHeader: class OptionAddon:
def load(self, loader): def load(self, loader):
loader.add_option( loader.add_option(
name = "testheader", name = "optionaddon",
typespec = typing.Optional[int], typespec = typing.Optional[int],
default = None, default = None,
help = "test header", help = "Option Addon",
) )
def configure(self, updates): def configure(self, updates):
raise exceptions.OptionsError("Options Error") 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 = [ addons = [
TestHeader() OptionAddon()
] ]