diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-08-23 00:39:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-23 00:39:30 -0700 |
commit | 06c499f76ebde90cee49871d9c4be1891f53f6c2 (patch) | |
tree | 59a76a43a8e3348f04ce09136c1ed703dde34a3f /examples/redirect_requests.py | |
parent | 798ce96bd0d22b642f8508c5d9a8e131bedb4896 (diff) | |
parent | f27028f58e50492c8c8e15e47278bf444d692246 (diff) | |
download | mitmproxy-06c499f76ebde90cee49871d9c4be1891f53f6c2.tar.gz mitmproxy-06c499f76ebde90cee49871d9c4be1891f53f6c2.tar.bz2 mitmproxy-06c499f76ebde90cee49871d9c4be1891f53f6c2.zip |
Merge pull request #1500 from mhils/simple-response-creation
Introduce Response.make for simple response creation
Diffstat (limited to 'examples/redirect_requests.py')
-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 |