I’m wondering if it’s possible to have mitmproxy introduce some sort of programmatic delays when proxying a request-response, to simulate slow networks or heavily loaded servers, etc.
I’m currently using it in reverse-proxy mode (although others would work), and from what I can see, there’s already the pause/modify functionality that could delay request/response as needed, but I can’t immediately see how it could be controlled from a handler inside an Addon.
I’ve skimmed the code in examples/ but nothing stands out, and I don’t know if there’s enough async wizardry going on that I could do something like
def request(): os.sleep(x) or if that’d just hang everything up.
Are there any docs/examples along these lines I could look at, or pointers for how it could be done?
Ideally I’d like the ability to make a simple addon that can be configured with filters & delay params, along the lines of http://wiremock.org/docs/simulating-faults/ in Wiremock.