Skip to content

Commit

Permalink
Fix recursive process to find handler based on Request URL path
Browse files Browse the repository at this point in the history
  • Loading branch information
mariomenjr committed Apr 27, 2022
1 parent 4e37a24 commit 71561d3
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,11 @@ func (rt *Router) buildPath() string {
// Recursively find a handler to the request
func (rt *Router) findHandler(r *http.Request) *ActionHandler {
for _, v := range rt.children {
if v.handler == nil {
continue
}

if v.isMatch(r) {
if v.handler != nil && v.isMatch(r) {
return v.handler
} else {
return v.findHandler(r)
}

v.findHandler(r)
}
return nil
}
Expand Down

0 comments on commit 71561d3

Please sign in to comment.