mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
25 lines
491 B
Python
25 lines
491 B
Python
|
from mitmproxy import ctx
|
||
|
|
||
|
|
||
|
class AddHeader:
|
||
|
def __init__(self):
|
||
|
self.num = 0
|
||
|
|
||
|
def load(self, loader):
|
||
|
loader.add_option(
|
||
|
name = "addheader",
|
||
|
typespec = bool,
|
||
|
default = False,
|
||
|
help = "Add a count header to responses",
|
||
|
)
|
||
|
|
||
|
def response(self, flow):
|
||
|
if ctx.options.addheader:
|
||
|
self.num = self.num + 1
|
||
|
flow.response.headers["count"] = str(self.num)
|
||
|
|
||
|
|
||
|
addons = [
|
||
|
AddHeader()
|
||
|
]
|