Description of the bug
Hoverfly in capture mode adding pairs that already exists from an imported simulation.
Steps to reproduce the issue
- Capture an API:
hoverctl start
hoverctl mode capture
curl --proxy localhost:8500 http://echo.jsontest.com/key/value/one/two
- Export the simulation:
hoverctl export echo.json
- Re-import it:
hoverctl import echo.json
- Do the capturing again:
curl --proxy localhost:8500 http://echo.jsontest.com/key/value/one/two
Observed result
If I inspect the simulations now: http://localhost:8888/api/v2/simulation, it shows two identical request/response pairs are captured.
Expected result
Only one request/response pair should be saved, as the second request is exactly the same as the first one.
Additional relevant information
- Hoverfly version: v1.0.0
- Anything that might help us to diagnose the problem
Debugging reveals that the request matcher structs created by importing and capturing are different. The default value for headers and query maps are nil when it's created by import, and they are empty maps when it's created by capturing. See the following screenshot.

Description of the bug
Hoverfly in capture mode adding pairs that already exists from an imported simulation.
Steps to reproduce the issue
hoverctl export echo.jsonhoverctl import echo.jsoncurl --proxy localhost:8500 http://echo.jsontest.com/key/value/one/twoObserved result
If I inspect the simulations now: http://localhost:8888/api/v2/simulation, it shows two identical request/response pairs are captured.
Expected result
Only one request/response pair should be saved, as the second request is exactly the same as the first one.
Additional relevant information
Debugging reveals that the request matcher structs created by importing and capturing are different. The default value for headers and query maps are nil when it's created by import, and they are empty maps when it's created by capturing. See the following screenshot.