Here’s the scenario: A coworker is working on a service and you just want to send a quick request to test it. You want to do this without deploying the service somewhere, asking them to send the request for you (or you both want to send requests at the same time), or needing to go through the whole process of asking this coworker to push the latest to their branch, pulling it down, and setting it up on your machine.
The latter reason could be particularly convincing if this service has a complicated configuration setup or is in a language you haven’t really set up on your machine. It’s also possible that the service requires lots of memory or you’ve got multiple services running at the same time, making development on the same machine a little slow.
Thankfully there’s a solution. If you’re on the same WIFI network, you can type the following to get the IP address of the laptop running the service:
ipconfig getifaddr en0
If you’re connected to the same network but through an ethernet cable you can use:
ipconfig getifaddr en1
Then all you need to do is make sure you form the request url with the correct IP address, port number, and endpoint path (e.g., 184.108.40.206:8080/v1/dadjokes). Now you’re all set!