Matching http request are passing
Hi,
First of all i love the idea of the library. Great Job guys!!!. I wanted to include the the library in my project, but i don't want to mock every request so i set MockConfig allowXHRPassthrough and allowFetchPassthrough to true. And the problem is every request is passing even when there is matching route and when there is response then data-mocks replace the response. Is that intended behaviour and can the requests be intercept when they match before sending(cause for example i want to mock and endpoint before is created)?
To Reproduce Just create angular project the cli and add data-mock. Set the allowXHRPassthrough and allowFetchPassthrough to true Create some scenario(example: { url: /users/, method: 'GET', response: { some: 'good response' }, responseCode: 200 }) Make a http call to that scenario(example: ''http://localhost:3000/api/users')
Hey @Tabris841 - two things!
- I'm so so so so sorry I didn't get back to you on this any sooner. I've been on leave with my newborn so I haven't had time to throw at data-mocks until now as I'm back in action!
- Thank you so much for bringing this issue up. I'll work on a fix for it this week :)
-Dave
Just dropping by to inform you I have the same problem.
I'm still planning on fixing this tomorrow :) Hopefully it'll be released then, too!
Current workaround is to use XHRMock proxy directly after injectMocks
injectMocks(scenarios, undefined, {
// allowXHRPassthrough: true,
});
XHRMock.use(proxy);
Sweet - a fix is in master and I've checked it out and it's good. I'll make a release now.
Version 2.5.13 is out now and should make everything all good. Let me know if you have any other questions/problems :) Once again, so sorry for taking so long to getting this one sorted!
Sweet! Works like a charm, thx! And don't be sorry, taking care for your newborn is far more important ;)