forked from mswjs/msw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(coercePath): widen regex to escape
:
in IPv6 address as well
This fixes a bug in tests where the preview server is bound to an IPv6 URL, which causes the matcher to fail when comparing the URL to origin, which causes the request to send wthout a `referer` header, which causes an error in the service worker and incorrect error snapshots (e.g. using full URL instead of relative URL because no match was found). Fix: * When escaping colons in path before passing to `path-to-regexp`, make sure to include colons in the host, but only if it's a bracketed IPv6 host (this means that you can use wildcards in a non-bracketed host if you really want to, e.g. `:subdomain.foo.com`) * Combine previously multiple regexes for scheme and port into a single regex for scheme, port, and host (since their logic is interdependent) * Add tests for various convoluted IPv6 scenarios and wildcard placements
- Loading branch information
1 parent
f9aa05a
commit b57db77
Showing
2 changed files
with
187 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters