Manipulating HTTP requests
In this section, we're going to learn more about inline scripts, and we're going to see an example of how to intercept requests and access their different parts of it.
Inline scripts
In the previous section, we defined a simple inline script in order to access the response from a request. Other parts of the communication, the mitmproxy, let us access the response via handlers:
start
: This is called once the script starts up, before any other eventsclientconnect
: This is called when a client initiates a connection to the proxy
Note
A connection can correspond to multiple HTTP requests.
request
: This is called when a client request has been receivedserverconnect
: This is called when the proxy initiates a connection to the target serverresponseheaders
: This is called when theresponseheaders
for a server response have been received, but the response body has not been processedresponse
: This is called when a server response has been receivederror
: This is called when a...