diff options
author | Jason Pepas <jasonpepas@gmail.com> | 2016-05-11 16:26:17 -0500 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-05-11 15:26:17 -0600 |
commit | b174fd5e1fe3a6eddec449f58a0db793820fa3a3 (patch) | |
tree | 825adf7a92ab8e2022a6ba1b06cf90490c78f691 | |
parent | bbf7b6f690fd61af5900df924b833140dc21daee (diff) | |
download | mitmproxy-b174fd5e1fe3a6eddec449f58a0db793820fa3a3.tar.gz mitmproxy-b174fd5e1fe3a6eddec449f58a0db793820fa3a3.tar.bz2 mitmproxy-b174fd5e1fe3a6eddec449f58a0db793820fa3a3.zip |
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.
-rw-r--r-- | examples/README | 1 | ||||
-rw-r--r-- | examples/fail_with_500.py | 3 |
2 files changed, 4 insertions, 0 deletions
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"" |