From b174fd5e1fe3a6eddec449f58a0db793820fa3a3 Mon Sep 17 00:00:00 2001 From: Jason Pepas Date: Wed, 11 May 2016 16:26:17 -0500 Subject: Adding example which turns every reponse into an HTTP 500. (#1136) * Adding example which turns every reponse into an HTTP 500. * Prefer b"" over None for response.content. --- examples/README | 1 + examples/fail_with_500.py | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 examples/fail_with_500.py diff --git a/examples/README b/examples/README index cf5c4d7d..90edf468 100644 --- a/examples/README +++ b/examples/README @@ -7,6 +7,7 @@ add_header.py Simple script that just adds a header to every request change_upstream_proxy.py Dynamically change the upstream proxy dns_spoofing.py Use mitmproxy in a DNS spoofing scenario. dup_and_replay.py Duplicates each request, changes it, and then replays the modified request. +fail_with_500.py Turn every response into an Internal Server Error. filt.py Use mitmproxy's filter expressions in your script. flowwriter.py Only write selected flows into a mitmproxy dumpfile. iframe_injector.py Inject configurable iframe into pages. diff --git a/examples/fail_with_500.py b/examples/fail_with_500.py new file mode 100644 index 00000000..aec85b50 --- /dev/null +++ b/examples/fail_with_500.py @@ -0,0 +1,3 @@ +def response(context, flow): + flow.response.status_code = 500 + flow.response.content = b"" -- cgit v1.2.3