appendPath func inconsistency
wanton7 opened this issue · 2 comments
wanton7 commented
Works
router := web.New(Context{})
router = router.Subrouter(Context{}, "/")
router.Get("/", index)
Panics
router := web.NewWithPrefix(Context{}, "/test")
router = router.Subrouter(Context{}, "/")
router.Get("/", index)
Works
router := web.NewWithPrefix(Context{}, "/test")
router = router.Subrouter(Context{}, "")
router.Get("", index)
wanton7 commented
I would have done a pull request but i don't really know git that well.
This should fix the problem
func appendPath(rootPath, childPath string) string {
return strings.TrimRight(rootPath, "/") + "/" + strings.TrimLeft(childPath, "/")
}