Open
Conversation
kettanaito
commented
Mar 19, 2026
| if (pattern instanceof RegExp) { | ||
| return { | ||
| matches: pattern.test(cleanUrl), | ||
| params: {}, |
Member
Author
There was a problem hiding this comment.
Support index-based matching groups as parameters? Not sure if that's how path-to-regexp behaved. Would be nice to match that behavior here.
commit: |
This was referenced Mar 20, 2026
1 task
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
URLPatternfor request matching #2209Breaking change
This is a breaking change. RegExp tokens in string patterns are no longer supported like in
path-to-regexpbecause string patterns don't compile to regexp anymore. This will break some consumers, but I predict the blast radius to be rather small.Changes
path-to-regexpto an in-house@msw/url. Path matching is no longer regexp-based but token-based. Better performance, fewer vulnerabilities.@msw/urlis faster thanpath-to-regexpin most scenarios, in others the performance is roughly the same).Todos
matchRequestUrl.test.ts. No need to assert whatmatchPatterndoes already. Actually test what the function does: handlesRegExp, cleans urls, normalizes the path, and 1-2 simple absolute/relative url matches for posterity.paramsvalue for matching againstRegExpinpath-to-regexp. If it returned index-based capturing groups, implement that.