-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: allow "/*catch-all" and "/normal" routes coexist #3270
base: master
Are you sure you want to change the base?
Conversation
default: | ||
panic("invalid node type") | ||
case catchAll: | ||
if path[0] != '/' { |
Check notice
Code scanning
Bad redirect check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if path[0] != '/'
and redirecting are not related
Codecov Report
@@ Coverage Diff @@
## master #3270 +/- ##
==========================================
- Coverage 98.36% 98.10% -0.27%
==========================================
Files 42 42
Lines 3124 3107 -17
==========================================
- Hits 3073 3048 -25
- Misses 38 45 +7
- Partials 13 14 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
8f2fd7a
to
cc8646c
Compare
9902cdb
to
90a6a2c
Compare
Please approval workflows. I force pushed because I fixed code coverage, and squashed commits down to just 2. |
Is there any progress on this feature? We need this feature. |
Allow
/*catch-all
and/normal
routes coexist, like/*filepath
,/users/me
,/users/*user
./users
will match/users/*user
, and the param will be[{"user": "/"}]
, unless route/users/
added.Param and catch-all parts are still in conflict:
/*filepath
,/:action
, but this is quite reasonable, after all, wo can't say that a path with only one slash should correspond to param.Reason for removing empty node before
/*catch-all
node:path
must start with a slash when entering catch-all.n.wildChild
will befalse
whenn
has a catch-all empty node as child, so we have to checkn.children[len(n.children)-1].wildChild
, there was no problem before because there would be no coexistence of/normal
routes and/*catch-all
routes before.fixes #2102
fixes #2846
fixes #2920
fixes #2930