I want to match the set of URLs, which are different with query parameters only. To achieve this goal, I pass regex instead of string to mock.get as the first parameter according to your specification
.get(url | regex, fn)
This approach misses the passed URL one time in a set of two requests if the regex value contains the global modifier (\g).
As the result, we will get the error at every second request. However, if we remove the global modifier from the regex, mock will start to work as expected.
Hello, team.
What's Up
I want to match the set of URLs, which are different with query parameters only. To achieve this goal, I pass regex instead of string to mock.get as the first parameter according to your specification
.get(url | regex, fn)
This approach misses the passed URL one time in a set of two requests if the regex value contains the global modifier (\g).Example
As the result, we will get the error at every second request. However, if we remove the global modifier from the regex, mock will start to work as expected.