Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio Andres Virviescas Santana committed Apr 24, 2020
1 parent 5c00298 commit 8fd2924
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion radix/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (n *node) add(method, path, fullPath string, handler fasthttp.RequestHandle
// }

isParam := wp.start == 0 && wp.pType == param
hasHandler := child.methods != nil && child.methods[method] != nil || handler == nil
hasHandler := (child.methods != nil && child.methods[method] != nil) || handler == nil

if len(path) == wp.end && isParam && hasHandler {
// The current segment is a param and it's duplicated
Expand Down
7 changes: 2 additions & 5 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (r *Router) DELETE(path string, handle fasthttp.RequestHandler) {
r.Handle(fasthttp.MethodDelete, path, handle)
}

// ALL
// ANY is a shortcut for router.Handle("*", path, handle)
func (r *Router) ANY(path string, handle fasthttp.RequestHandler) {
r.Handle(radix.MethodWildcard, path, handle)
}
Expand Down Expand Up @@ -262,10 +262,7 @@ func (r *Router) Handle(method, path string, handle fasthttp.RequestHandler) {
path = r.beginPath + path
}

newMethod := false
if r.registeredPaths[method] == nil {
newMethod = true
}
newMethod := r.registeredPaths[method] == nil

r.registeredPaths[method] = append(r.registeredPaths[method], path)

Expand Down

0 comments on commit 8fd2924

Please sign in to comment.