Replace methodTypString func with reverseMethodMap (#1018)

This code predates the introduction of the reverseMethodMap.
This commit is contained in:
James Raspass 2025-08-26 20:56:01 +03:00 committed by GitHub
parent 0265fcd786
commit 9b9fb55def
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

15
tree.go
View file

@ -650,11 +650,9 @@ func (n *node) routes() []Route {
if h.handler == nil {
continue
}
m := methodTypString(mt)
if m == "" {
continue
if m, ok := reverseMethodMap[mt]; ok {
hs[m] = h.handler
}
hs[m] = h.handler
}
rt := Route{subroutes, hs, p}
@ -788,15 +786,6 @@ func longestPrefix(k1, k2 string) int {
return i
}
func methodTypString(method methodTyp) string {
for s, t := range methodMap {
if method == t {
return s
}
}
return ""
}
type nodes []*node
// Sort the list of nodes by label