diff --git a/httpr.go b/httpr.go index 7e2a48d..d085c88 100644 --- a/httpr.go +++ b/httpr.go @@ -20,6 +20,8 @@ func newPath(path string) (path, error) { return nil, errors.New("there can be only one catch-all (*) parameter in path") } + path = strings.ReplaceAll(path, "//", "/") + parts := strings.Split(strings.TrimSuffix(path, "/"), "/") parts[0] = "/" @@ -75,6 +77,10 @@ outer: if pathLen > i+1 { var paramNode *node + if len(curNode.children) == 0 { + break outer + } + for _, next := range curNode.children { if next.endpoint == path[i+1] { curNode = next