aboutsummaryrefslogtreecommitdiffstats
path: root/examples/redirect_requests.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-10-16 23:49:54 -0700
committerMaximilian Hils <git@maximilianhils.com>2016-10-16 23:49:54 -0700
commit02d3d618204bce2bc0ed088a556a94a8479dcf31 (patch)
treee4c0913d0c4675c815d0e0ffa3b53d9cab3f5937 /examples/redirect_requests.py
parent43a83c89e73905daa7ebc27313a45546f0a33f61 (diff)
downloadmitmproxy-02d3d618204bce2bc0ed088a556a94a8479dcf31.tar.gz
mitmproxy-02d3d618204bce2bc0ed088a556a94a8479dcf31.tar.bz2
mitmproxy-02d3d618204bce2bc0ed088a556a94a8479dcf31.zip
fix redirect_requests.py example
Diffstat (limited to 'examples/redirect_requests.py')
-rw-r--r--examples/redirect_requests.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/examples/redirect_requests.py b/examples/redirect_requests.py
index 8cde1bfd..bbb84e2f 100644
--- a/examples/redirect_requests.py
+++ b/examples/redirect_requests.py
@@ -11,8 +11,7 @@ def request(flow):
# Method 1: Answer with a locally generated response
if flow.request.pretty_host.endswith("example.com"):
- resp = HTTPResponse.make(200, b"Hello World", {"Content-Type": "text/html"})
- flow.reply.send(resp)
+ flow.response = HTTPResponse.make(200, b"Hello World", {"Content-Type": "text/html"})
# Method 2: Redirect the request to a different server
if flow.request.pretty_host.endswith("example.org"):