Using mitmproxy reverse mode for API testing

mitmproxy is my preferred proxy for API testing these days. I’m using it mostly in reverse mode though, so I thought I’d capture my setup in case it’s useful for anyone else. My main use case is to inspect the traffic coming into the API server and being returned, mostly when running tests against it. Where mitmproxy is typically used as a proxy to monitor traffic passing into/out of a client application, for this I’m concerned with the server’s handling. Reverse mode lets me inspect and adjust the traffic as I go along. I start up the proxy, configure the tests to point to it instead of the actual server, and I’m all set. Continue reading