Created
December 1, 2023 01:35
-
-
Save avernet/bb071ba621798f40b3fce7c8579bf27e to your computer and use it in GitHub Desktop.
mitmproxy: add a `My-Counter` header incremented with every request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mitmproxy import http | |
class AddHeader: | |
def __init__(self): | |
self.counter = 0 | |
def request(self, flow: http.HTTPFlow) -> None: | |
self.counter += 1 | |
flow.request.headers["My-Counter"] = str(self.counter) | |
addons = [ | |
AddHeader() | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment