mitmproxy's interception functionality lets you pause an HTTP request or response, inspect and modify it, and then accept it to send it on to the server or client. Because this is an interactive function, it's only present in mitmproxy, not in mitmdump.
We press i to set an interception pattern. In this case, the ~q filter pattern tells mitmproxy to intercept all requests. For complete filter syntax, see the Filter expressions section of this document, or the built-in help function in mitmproxy.
In this case, we viewed the request by selecting it, pressed e for "edit" and m for "method" to change the HTTP request method.
Finally, we press a to accept the modified request, which is then sent on to the server. In this case, we changed the request from an HTTP GET to to OPTIONS, and Google's server has responded with a 405 "Method not allowed".
© mitmproxy project, 2011