Did the readme’s examples work? It is a bit weird that the code here stubs /foo and then requests /foo/.
On the theory that you post here because you are interested in the opinions of generalists, I would venture to suggest (and the readme also hints of this) that the circumstances are unfortunate, when you need to intercept your program’s outgoing HTTP requests and divert them to a webserver your program runs on a random ephemeral port. Wrong way. Red blinky lights.
Hi. Not sure what the context is here. If you are trying to do this in a test, have you considered using with-redefs? Especially if you can isolate the network call in a function by itself ie
You need to use uri from stub. stub starts a local server on a random port and you need to send requests to that server. Take a look at how they send a request in this example: