Closed kingtimm closed 3 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 95.66%. Comparing base (
db3a623
) to head (35d94e5
). Report is 10 commits behind head on v2.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks for PR dear @kingtimm and sorry it is delayed. Main reason is that, the consumer libs (mainly unjs/h3) are already doing this normalization. It is not a breaking-change per-se but doing this means performance overhead of iterating string twice. Because of this i plan this in next major release to be included so we can adjust h3 router behavior while upgrading.
I suggest this should be optional. I some case, we may need to match the route along with the query params;
Maybe having something like {query: true}
and false
being the default value, we could have this without breaking anything.
Hi dear @kingtimm. I had been thinking about this for a while and while in some direct usecases it makes sense, i think it would be the best to let it up to the users to remove query params and pass pathname themselves.
In cases of using with web APIs, if users already parsed URL with new URL
, they already have access to url.pathname
. This improves perf, reusability (if we drop internally in rou3, users need to parse again) and also stability since URL parsing has many edge cases.
๐ Linked issue
fixes #54 - inclusion of queryparameters on a path make it fail to match.
โ Type of change
๐ Description
Removed query parameters from the path before it is matched. The router did not seem to support them anyway.
My use-case was in nuxt-vitest's registerEndpoint but found others running into it.
Resolves #54
๐ Checklist