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://ip.jsontest.com
hoverctl destination "ip" --dry-run http://time.jsontest.com
hoverctl stop

This tells us that setting the destination to ip will allow the URL http://ip.jsontest.com to be captured or simulated, while the URL http://time.jsontest.com 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://ip.jsontest.com
curl --proxy http://localhost:8500 http://time.jsontest.com
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://ip.jsontest.com 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.