Skip to content

Commit 9b9fb55

Browse files
authored
Replace methodTypString func with reverseMethodMap (#1018)
This code predates the introduction of the reverseMethodMap.
1 parent 0265fcd commit 9b9fb55

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

tree.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -650,11 +650,9 @@ func (n *node) routes() []Route {
650650
if h.handler == nil {
651651
continue
652652
}
653-
m := methodTypString(mt)
654-
if m == "" {
655-
continue
653+
if m, ok := reverseMethodMap[mt]; ok {
654+
hs[m] = h.handler
656655
}
657-
hs[m] = h.handler
658656
}
659657

660658
rt := Route{subroutes, hs, p}
@@ -788,15 +786,6 @@ func longestPrefix(k1, k2 string) int {
788786
return i
789787
}
790788

791-
func methodTypString(method methodTyp) string {
792-
for s, t := range methodMap {
793-
if method == t {
794-
return s
795-
}
796-
}
797-
return ""
798-
}
799-
800789
type nodes []*node
801790

802791
// Sort the list of nodes by label

0 commit comments

Comments
 (0)