Return custom response with mitmproxy
<p>I'm trying to return custom response when using mitmproxy with the following code</p>

<pre><code>from libmproxy.models import HTTPResponse
from netlib.http import Headers

def request(context, flow):
    if flow.request.pretty_url.endswith("example.com/index.php"):
        resp = HTTPResponse(
            [1, 1], 200, "OK",
            Headers(Content_Type="text/html"),
            "&lt;html&gt;&lt;body&gt;hello world&lt;/body&gt;&lt;/html&gt;")
        flow.reply(resp)
</code></pre>

<p>But the result is not as expected, in browser it shows up with http status codes, headers och body as clear text</p>

<pre><code>[1,1] 200 OK
Content-Type: text/html

&lt;html&gt;&lt;body&gt;hello world&lt;/body&gt;&lt;/html&gt;
</code></pre>

<p>how can i return it as actual "http" response so that chrome render it as html?</p>