Recently, when I was working on a desktop application, I wanted to test it's usability when certain APIs fail. For this I wanted to block a certain API, but couldn't find a simple straightforward way to do this. Maybe I could've done something with the /etc/hosts file, but wasn't able to make it do what I want. This got me thinking about developing a simple application, which creates a proxy to which we can connect to, and it allows us to blacklist urls. ( Further features can be defining the time taken by the API to respond back, setting a status code it responds back with etc )So, I have a few questions -<p>1. Is there a simple solution which allows us to do this ?
2. Do you think the solution is technically feasible ?
3. Would you be willing to use an application like this ? If Yes, What are some other use cases of the solution and what features do you think it should have ?
1. MITMProxy[1] is scriptable (Python API) to modify requests/responses, or HTTP ToolKit[2] seems to be more on the non-code side (haven't used it).<p>2. Sure, but there's not much value in it. An API is the available contract for the communication between services. The server needs to guarantee it and the client can implement the needed parts. The client should implement solutions for server-side error cases either way, handle rate limiting, and send each request with a timeout. Everything else relies on the guarantee of the server, which, as the client, isn't your responsibility.<p>3. Only when i need a quick workaround for a feature the server doesn't provide (e.g. CORS injection) and maybe for test automation.<p>[1] <a href="https://mitmproxy.org/" rel="nofollow">https://mitmproxy.org/</a><p>[2] <a href="https://httptoolkit.tech/" rel="nofollow">https://httptoolkit.tech/</a>