mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-06 21:43:05 +02:00
11 lines
343 B
Python
11 lines
343 B
Python
from mitmproxy import http
|
|
|
|
def request(flow: http.HTTPFlow) -> None:
|
|
# Only intercept traffic to example.com
|
|
if "example.com" in flow.request.host:
|
|
flow.response = http.Response.make(
|
|
502, # Bad Gateway status code
|
|
b"Simulated connection failure",
|
|
{"Content-Type": "text/plain"}
|
|
)
|