Replace methodTypString func with reverseMethodMap (#1018)
This code predates the introduction of the reverseMethodMap.
This commit is contained in:
parent
0265fcd786
commit
9b9fb55def
1 changed files with 2 additions and 13 deletions
15
tree.go
15
tree.go
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue