diff options
Diffstat (limited to 'examples/simple/modify_form.py')
-rw-r--r-- | examples/simple/modify_form.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/simple/modify_form.py b/examples/simple/modify_form.py new file mode 100644 index 00000000..b425efb0 --- /dev/null +++ b/examples/simple/modify_form.py @@ -0,0 +1,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") + ] |