diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-08-23 00:17:06 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-08-23 00:17:06 -0700 |
commit | f27028f58e50492c8c8e15e47278bf444d692246 (patch) | |
tree | 59a76a43a8e3348f04ce09136c1ed703dde34a3f /examples | |
parent | 798ce96bd0d22b642f8508c5d9a8e131bedb4896 (diff) | |
download | mitmproxy-f27028f58e50492c8c8e15e47278bf444d692246.tar.gz mitmproxy-f27028f58e50492c8c8e15e47278bf444d692246.tar.bz2 mitmproxy-f27028f58e50492c8c8e15e47278bf444d692246.zip |
introduce Response.make for simple response creation
Diffstat (limited to 'examples')
-rw-r--r-- | examples/redirect_requests.py | 7 |
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 |