diff options
author | tjpcc <tjp@ctrl-c.club> | 2023-10-09 10:29:18 -0600 |
---|---|---|
committer | tjpcc <tjp@ctrl-c.club> | 2023-10-09 10:29:18 -0600 |
commit | c38b7ad69d738281e6569e447e8d3e634097d9a4 (patch) | |
tree | d90450fb20f876dc0fc63c567137e9037fc2c10f /router.go | |
parent | 64b06db74da3bb77c7bd703bf9124fed83c47d7f (diff) |
fix for Router.Mount()v1.4.1
Diffstat (limited to 'router.go')
-rw-r--r-- | router.go | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -86,9 +86,14 @@ func (r *Router) Mount(prefix string, subrouter *Router) { prefix = strings.TrimSuffix(prefix, "/") for _, subroute := range subrouter.tree.Routes() { - r.Route(path.Join(prefix, subroute.Pattern), subroute.Value) - if subroute.Pattern == "/" { + fullroute := path.Join(prefix, subroute.Pattern) + if strings.HasSuffix(subroute.Pattern, "/") { + fullroute = fullroute + "/" + } + r.Route(fullroute, subroute.Value) + if subroute.Pattern == "/" || subroute.Pattern == "" { r.Route(prefix, subroute.Value) + r.Route(prefix+"/", subroute.Value) } } } |