httprouter icon indicating copy to clipboard operation
httprouter copied to clipboard

Named parameter in the beginning of route is producing an wildcard route conflicts with existing children in path error

Open ericreis opened this issue 3 years ago • 1 comments

I have the two following routes declared in my application:

router := httprouter.New()
router.Handler("GET", "/meta/healthcheck", http.HandlerFunc(rts.HealthCheck))
router.Handler("GET", "/:an/pricing/prices/:sku/computed/:priceTable", http.HandlerFunc(rts.ComputePrice))

However, this is producing the following error:

panic: wildcard route ':an' conflicts with existing children in path '/:an/pricing/prices/:sku/computed/:priceTable'

From my understanding, I can't have both a parameter and a static value in the same path position, but I think this shouldn't be an issue.

ericreis avatar Jun 24 '21 18:06 ericreis

I think this is a duplicate for https://github.com/julienschmidt/httprouter/issues/183

giuliodambrosio avatar Jun 29 '21 08:06 giuliodambrosio