julienschmidt / httprouter

A high performance HTTP request router that scales well
https://pkg.go.dev/github.com/julienschmidt/httprouter
BSD 3-Clause "New" or "Revised" License
16.57k stars 1.47k forks source link

wildcard route ':userId' conflicts with existing children in path '/v2/user/:userId' #275

Closed ssrs100 closed 5 years ago

ssrs100 commented 5 years ago

I am refactoring some code with golang, it 's written by java before. And then i got a problem, the https apis like blow are not allowed:

    router := httprouter.New()
    router.GET("/v2/user/details", listUserDetails)
    router.GET("/v2/user/:userId", lookupUser)

got some error:

panic: wildcard route ':userId' conflicts with existing children in path '/v2/user/:userId'

goroutine 1 [running]:
github.com/julienschmidt/httprouter.(*node).insertChild(0xc000082140, 0xc00006fd01, 0x696989, 0x7, 0x696980, 0x10, 0x6a8088)
layxyer commented 5 years ago

I also encountered this problem, this uri is in line with restful style,But the framework does not seem to support

julienschmidt commented 5 years ago

See #183