Capturing or simulating specific URLs

We can use the hoverctl destination command to specify which URLs to capture or simulate. The destination setting can be tested using the --dry-run flag. This makes it easy to check whether the destination setting will filter out URLs as required.

hoverctl start
hoverctl destination "ip" --dry-run http://api.ipify.org
hoverctl destination "ip" --dry-run http://httpbin.org
hoverctl stop

This tells us that setting the destination to ip will allow the URL http://api.ipify.org to be captured or simulated, while the URL http://httpbin.org will be ignored.

Now we have checked the destination setting, we can apply it to filter out the URLs we don’t want to capture.

hoverctl start
hoverctl destination "ip" 
hoverctl mode capture
curl --proxy http://localhost:8500 http://api.ipify.org
curl --proxy http://localhost:8500 http://httpbin.org
hoverctl logs
hoverctl export simulation.json
hoverctl stop

If we examine the logs and the simulation.json file, we can see that only a request response pair to the http://api.ipify.org URL has been captured.

The destination setting can be either a string or a regular expression.

hoverctl start
hoverctl destination "^.*api.*com" --dry-run https://api.github.com
hoverctl destination "^.*api.*com" --dry-run https://api.slack.com
hoverctl destination "^.*api.*com" --dry-run https://github.com
hoverctl stop

Here, we can see that setting the destination to ^.*api.*com will allow the https://api.github.com and https://api.slack.com URLs to be captured or simulated, while the https://github.com URL will be ignored.