I try to use Axios mock adapter to simulate GET to Web API, but it does not work.
The api url looks like something like that :
`/api/forms/${guid}`
I try using Regex, but doesn't work (probably something with the d+):
mock.onGet('/\/api\/forms\/\d+/').reply((config) => {
// the actual id can be grabbed from config.url
console.log(config);
return [200, {}];
});
This work:
mock.onGet('/users').reply((config) => {
// the actual id can be grabbed from config.url
console.log(config);
return [200, {}];
});
Regex should not be quoted in JavaScript.
Try this:
mock.onGet(/\/api\/forms\/\d+/).reply((config) => {