fix for Router.Mount()
This commit is contained in:
parent
64b06db74d
commit
c38b7ad69d
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue