gin
gin copied to clipboard
Feat: allow "/*catch-all" and "/normal" routes coexist
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:
- Now empty node can't guarantee that
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
Codecov Report
Merging #3270 (8f2fd7a) into master (ad66d9d) will decrease coverage by
0.26%
. The diff coverage is99.42%
.
:exclamation: Current head 8f2fd7a differs from pull request most recent head 90a6a2c. Consider uploading reports for the commit 90a6a2c to get more accurate results
@@ 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
Flag | Coverage Δ | |
---|---|---|
98.10% <99.42%> (-0.27%) |
:arrow_down: | |
go-1.15 | 98.10% <99.42%> (-0.27%) |
:arrow_down: |
go-1.16 | ∅ <ø> (?) |
|
go-1.17 | 98.00% <99.42%> (-0.27%) |
:arrow_down: |
go-1.18 | 98.00% <99.42%> (-0.27%) |
:arrow_down: |
macos-latest | 98.10% <99.42%> (-0.27%) |
:arrow_down: |
ubuntu-latest | 98.10% <99.42%> (-0.27%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
Impacted Files | Coverage Δ | |
---|---|---|
tree.go | 98.57% <99.42%> (-1.43%) |
:arrow_down: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
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.