-
Notifications
You must be signed in to change notification settings - Fork 10
WIP: Omit certain paths from mocking #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
290cb58
to
a270254
Compare
The idea with The solution with Additionally, there is a option to mock specific http method given as second parameter: this.passthrough(request => {
return request.queryParams.skipMirage;
}); There is also very interesting pattern in the MSW package: https://mswjs.io/docs/api/setup-worker/start#onunhandledrequest So, what do you think about the above ideas. |
Good. Seems we're going in the good direction then
This would also be possible with
Not sure what "skipping" in this context means. In our case, a request must either be responded by mockiavelli, or passed through to the original server.
Yes, I had a similar idea as well. However, the case of Mockiavelli is a bit different. It intercepts all types of requests, and treats unhandled XHR/fetch requests differently (error) than other requests (pass-through). So a simple "passtrough" / "error" option does not fit in here. |
a270254
to
d3adbbd
Compare
Allow to mock HTTP request regardless of request method.
reopening - this shouldn't be closed automatically |
I really need it |
@lukaszfiszer what's up with it? |
This PR will introduce
mockiavelli.passThrough
method, that gives user the ability to define which endpoints should not be mocked (requested in #10 ):Any request that matches the URL will be forwarded to the original endpoint using
request.continue()
/route.continue()
methods from ppter/playwright APIs.It will work very similar to existing
mockiavelli.mock
methods and use the same underlying request matching mechanism. User will be able to mix and overridemockiavelli.passThrough
withmockiavelli.mock
Few internal improvements are required in order to make this method more user-friendly:
/api/**/*
,**/*.js
- feat: add support for wildcards (*) in URL #31