aboutsummaryrefslogtreecommitdiffstats
path: root/examples/redirect_requests.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/redirect_requests.py')
-rw-r--r--examples/redirect_requests.py7
1 files changed, 1 insertions, 6 deletions
diff --git a/examples/redirect_requests.py b/examples/redirect_requests.py
index 36594bcd..8cde1bfd 100644
--- a/examples/redirect_requests.py
+++ b/examples/redirect_requests.py
@@ -2,7 +2,6 @@
This example shows two ways to redirect flows to other destinations.
"""
from mitmproxy.models import HTTPResponse
-from netlib.http import Headers
def request(flow):
@@ -12,11 +11,7 @@ def request(flow):
# Method 1: Answer with a locally generated response
if flow.request.pretty_host.endswith("example.com"):
- resp = HTTPResponse(
- b"HTTP/1.1", 200, b"OK",
- Headers(Content_Type="text/html"),
- b"helloworld"
- )
+ resp = HTTPResponse.make(200, b"Hello World", {"Content-Type": "text/html"})
flow.reply.send(resp)
# Method 2: Redirect the request to a different server