Applying different delays based on HTTP method¶
Let’s apply a delay of 2 seconds on responses to GET requests only made to echo.jsontest.com/b/c
.
Run the following to create and export a simulation.
hoverctl start
hoverctl mode capture
curl --proxy localhost:8500 http://echo.jsontest.com/b/c
curl --proxy localhost:8500 -X POST http://echo.jsontest.com/b/c
hoverctl export simulation.json
hoverctl stop
Edit the simulation.json
file so that the "globalActions"
property looks like this:
1 "globalActions": {
2 "delays": [
3 {
4 "urlPattern": "echo\\.jsontest\\.com\\/b\\/c",
5 "httpMethod": "GET",
6 "delay": 2000
7 }
8 ],
9 "delaysLogNormal": []
Now run the following to import the edited simulation.json
file and run the simulation:
hoverctl start
hoverctl import simulation.json
curl --proxy localhost:8500 http://echo.jsontest.com/b/c
curl -X POST --proxy localhost:8500 http://echo.jsontest.com/b/c
hoverctl stop
You should notice a 2 second delay on the response to the GET request and no delay on the response to the POST request.