mitmproxy/examples/addons/http-modify-form.py

13 lines
461 B
Python
Raw Normal View History

"""Modify an HTTP form submission."""
2017-04-28 21:56:14 +00:00
from mitmproxy import http
def request(flow: http.HTTPFlow) -> None:
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.
2022-04-26 11:53:35 +00:00
flow.request.urlencoded_form = [("foo", "bar")]