My script does the following:
- (done) Forward the original request
- (done) If the response content contains a know string, then
- (done) Make a new request with python’s requests library, extract a session cookie
- Modify the original request with the newly obtained sessions cookie
- Replay the now modified request
- Return the modified requests’ response as if it were the original requests’ response
How can I replay the flow’s request from inside a mitmproxy script’s response method and return the newly obtained response as if it were the response to the original request?