aboutsummaryrefslogtreecommitdiffstats
path: root/examples/complex/dup_and_replay.py
blob: 3ad98dc515a46f2d3b79a81c2ed93788c73f28e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from mitmproxy import ctx


def request(flow):
    # Avoid an infinite loop by not replaying already replayed requests
    if flow.request.is_replay:
        return
    flow = flow.copy()
    # Only interactive tools have a view. If we have one, add a duplicate entry
    # for our flow.
    if "view" in ctx.master.addons:
        ctx.master.commands.call("view.flows.add", [flow])
    flow.request.path = "/changed"
    ctx.master.commands.call("replay.client", [flow])