mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-29 19:08:44 +00:00
08895e9ba6
- restructure examples (fix #4031) - remove example dependencies from setup.py, we do not need special dependencies for our supported addons. - unify how we generate docs from code - improve example docs
12 lines
428 B
Python
12 lines
428 B
Python
"""Send a reply from the proxy without sending any data to the remote server."""
|
|
from mitmproxy import http
|
|
|
|
|
|
def request(flow: http.HTTPFlow) -> None:
|
|
if flow.request.pretty_url == "http://example.com/path":
|
|
flow.response = http.HTTPResponse.make(
|
|
200, # (optional) status code
|
|
b"Hello World", # (optional) content
|
|
{"Content-Type": "text/html"} # (optional) headers
|
|
)
|