aboutsummaryrefslogtreecommitdiffstats
path: root/examples/simple/modify_form.py
blob: b425efb08a43e2ec9cd980529956820efc1ca6b1 (plain)
1
2
3
4
5
6
7
8
9
10
def request(flow):
    if flow.request.urlencoded_form:
        # If there's already a form, one can just add items to the dict:
        flow.request.urlencoded_form["mitmproxy"] = "rocks"
    else:
        # One can also just pass new form data.
        # This sets the proper content type and overrides the body.
        flow.request.urlencoded_form = [
            ("foo", "bar")
        ]