You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #2202 it took me a while to figure out how to use MSW with SuperTest. It's making requests to random ports, which MSW is reporting as warnings/errors because they hadn't been intercepted. The goal is to tell MSW to ignore them, because those are requests to our own app.
It's clear that MSW has a parameter component of the URL preceded by the colon, but it seems to also supports an asterisk as a catch-all, which is what I was looking for in this case. However, I seem to have unfortunately combined both of them by preceding the asterisk with the colon and achieved a result that I didn't understand 😬
Luckily, after removing the colon everything worked as expected. I believe URL patterns should be documented in a way that makes it clear to people how to deal with situations like SuperTest.
Btw, did I stumble upon a bug? I guess URL matching can't really recognize ports vs. params when the URL is not finished.
The text was updated successfully, but these errors were encountered:
I believe we do mention the documentation for it. MSW uses a package called path-to-regexp, which has become the standard for path matching in JavaScript (used in Express, lies in the foundation of the upcoming URLPattern standard API).
Please read that package's README to learn about the supported special tokens when defining paths. Thanks!
In #2202 it took me a while to figure out how to use MSW with SuperTest. It's making requests to random ports, which MSW is reporting as warnings/errors because they hadn't been intercepted. The goal is to tell MSW to ignore them, because those are requests to our own app.
It's clear that MSW has a parameter component of the URL preceded by the colon, but it seems to also supports an asterisk as a catch-all, which is what I was looking for in this case. However, I seem to have unfortunately combined both of them by preceding the asterisk with the colon and achieved a result that I didn't understand 😬
Luckily, after removing the colon everything worked as expected. I believe URL patterns should be documented in a way that makes it clear to people how to deal with situations like SuperTest.
Btw, did I stumble upon a bug? I guess URL matching can't really recognize ports vs. params when the URL is not finished.
The text was updated successfully, but these errors were encountered: