How To Mock Functions That Have External HTTP Requests
When writing tests, we do not want to hit the external API each time we run our tests. If we are coming from a dynamic language, such as Node.JS, we may want to a solution like fetch-mock which will patch the implementation of fetch
at runtime. This is not practical in Rust. There are some attempts, like the hotpatch crate, but we will use a different strategy.