mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
Changes
This commit is contained in:
parent
61617919ff
commit
79b8fcc052
@ -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()
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user