@@ -478,7 +478,7 @@ walk: // Outer loop for walking the tree
478
478
// We can recommend to redirect to the same URL without a
479
479
// trailing slash if a leaf exists for that path.
480
480
value .tsr = path == "/" && n .handlers != nil
481
- return
481
+ return value
482
482
}
483
483
484
484
// Handle wildcard child, which is always at the end of the array
@@ -533,20 +533,20 @@ walk: // Outer loop for walking the tree
533
533
534
534
// ... but we can't
535
535
value .tsr = len (path ) == end + 1
536
- return
536
+ return value
537
537
}
538
538
539
539
if value .handlers = n .handlers ; value .handlers != nil {
540
540
value .fullPath = n .fullPath
541
- return
541
+ return value
542
542
}
543
543
if len (n .children ) == 1 {
544
544
// No handle found. Check if a handle for this path + a
545
545
// trailing slash exists for TSR recommendation
546
546
n = n .children [0 ]
547
547
value .tsr = (n .path == "/" && n .handlers != nil ) || (n .path == "" && n .indices == "/" )
548
548
}
549
- return
549
+ return value
550
550
551
551
case catchAll :
552
552
// Save param value
@@ -578,7 +578,7 @@ walk: // Outer loop for walking the tree
578
578
579
579
value .handlers = n .handlers
580
580
value .fullPath = n .fullPath
581
- return
581
+ return value
582
582
583
583
default :
584
584
panic ("invalid node type" )
@@ -609,20 +609,20 @@ walk: // Outer loop for walking the tree
609
609
// Check if this node has a handle registered.
610
610
if value .handlers = n .handlers ; value .handlers != nil {
611
611
value .fullPath = n .fullPath
612
- return
612
+ return value
613
613
}
614
614
615
615
// If there is no handle for this route, but this route has a
616
616
// wildcard child, there must be a handle for this path with an
617
617
// additional trailing slash
618
618
if path == "/" && n .wildChild && n .nType != root {
619
619
value .tsr = true
620
- return
620
+ return value
621
621
}
622
622
623
623
if path == "/" && n .nType == static {
624
624
value .tsr = true
625
- return
625
+ return value
626
626
}
627
627
628
628
// No handle found. Check if a handle for this path + a
@@ -632,11 +632,11 @@ walk: // Outer loop for walking the tree
632
632
n = n .children [i ]
633
633
value .tsr = (len (n .path ) == 1 && n .handlers != nil ) ||
634
634
(n .nType == catchAll && n .children [0 ].handlers != nil )
635
- return
635
+ return value
636
636
}
637
637
}
638
638
639
- return
639
+ return value
640
640
}
641
641
642
642
// Nothing found. We can recommend to redirect to the same URL with an
@@ -662,7 +662,7 @@ walk: // Outer loop for walking the tree
662
662
}
663
663
}
664
664
665
- return
665
+ return value
666
666
}
667
667
}
668
668
0 commit comments