diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/README | 2 | ||||
-rw-r--r-- | examples/modify_form.py | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/examples/README b/examples/README index 696705a5..24b5c2fe 100644 --- a/examples/README +++ b/examples/README @@ -1,6 +1,6 @@ add_header.py Simple script that just adds a header to every request. flowbasic Basic use of mitmproxy as a library. +modify_form.py Modify all form submissions to add a parameter. stub.py Script stub with a method definition for every event. stickycookies An example of writing a custom proxy with libmproxy. upsidedownternet.py Rewrites traffic to turn PNGs upside down. - diff --git a/examples/modify_form.py b/examples/modify_form.py new file mode 100644 index 00000000..2d839aed --- /dev/null +++ b/examples/modify_form.py @@ -0,0 +1,8 @@ + +def request(context, flow): + if "application/x-www-form-urlencoded" in flow.request.headers["content-type"]: + frm = flow.request.get_form_urlencoded() + frm["mitmproxy"] = ["rocks"] + flow.request.set_form_urlencoded(frm) + + |