miragejs / mirage-msw

4 stars 4 forks source link

Add passthrough support #11

Closed IanVS closed 1 year ago

IanVS commented 1 year ago

This adds support for adding passthroughs to msw from a mirage config.

It's handled a bit similarly to pretender, which uses route-recognizer. This also does, but it builds up a Map of hosts to a Map of verbs to route recognizers. I'm using this in my own app with a pnpm patch, and it seems to work correctly, though it's a bit noisy because MSW tries to handle all requests, even for favicons and other resources on the local host.

There are two main improvements to make still:

Not sure if either should be considered blocking on this PR, or we can open an issue to tackle them later since this is at least an improvement.

IanVS commented 1 year ago

Alright, this should be ready for review now whenever you have time, @bgantzler. I've implemented passthrough functions, and I'm preventing warning messages for requests for assets like the favicon and other static assets, which can happen during hot module reloading, for instance.

IanVS commented 1 year ago

@cah-brian-gantzler do you have time to review this, or should I just merge it and proceed? I'm fine with either approach, just want to make sure you have a chance to take a look if you want to.

cah-brian-gantzler commented 1 year ago

Im really out of touch with the MSW stuff. Thanks for doing this and asking, but I wouldnt wait on me (as I see you didnt 😄 )