gocraft/web

appendPath func inconsistency

wanton7 opened this issue · 2 comments

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)

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, "/")
}

@wanton7 fixed. thx