Applying different delays based on hostΒΆ

To apply a delay of 1 second on responses from time.jsontest.com and a delay of 2 seconds on responses from date.jsontest.com, save the following inside delays.json.

{
  "data": [
    {
      "urlPattern": "time\\.jsontest\\.com",
      "delay": 1000
    },
    {
      "urlPattern": "date\\.jsontest\\.com",
      "delay": 2000
    }
  ]
}

Now run the following:

hoverctl start
hoverctl mode capture
curl --proxy localhost:8500 http://time.jsontest.com
curl --proxy localhost:8500 http://date.jsontest.com
hoverctl mode simulate
hoverctl delays delays.json
curl --proxy localhost:8500 http://time.jsontest.com
curl --proxy localhost:8500 http://date.jsontest.com

You should notice a 1 second delay on responses from time.jsontest.com, and a 2 second delay on responses from date.jsontest.com.

Note

You can easily get into a situation where your request URL has multiple matches within your delays.json file. In this case, the first successful match wins.