Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wildcard route ':id' conflicts with existing children in path #28

Closed
tochka opened this issue Mar 29, 2017 · 2 comments
Closed

wildcard route ':id' conflicts with existing children in path #28

tochka opened this issue Mar 29, 2017 · 2 comments

Comments

@tochka
Copy link

tochka commented Mar 29, 2017

I have the following routers, but when I run the program I see the next error

r.POST("/user/actions/search", s)
r.POST("/user/:id/collections/relations", addR)
r.DELETE("/user/:id/collections/relations", removeR)
r.GET("/user/:id", g)
r.POST("/user", a)
r.DELETE("/user/:id",d)
panic: wildcard route ':id' conflicts with existing children in path '/user/:id/collections/relations'

goroutine 1 [running]:
panic(0x29b840, 0xc420138540)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/buaazp/fasthttprouter.(*node).insertChild(0xc420012230, 0xc42004fb01, 0x31193c, 0x19, 0x311933, 0x22, 0xc4313d3410)
        /Users/user/go/src/github.com/buaazp/fasthttprouter/tree.go:237 +0xc27
github.com/buaazp/fasthttprouter.(*node).addRoute(0xc420012230, 0x311933, 0x22, 0xc4313d3410)
        /Users/user/go/src/github.com/buaazp/fasthttprouter/tree.go:193 +0x217
github.com/buaazp/fasthttprouter.(*Router).Handle(0xc4313d3320, 0x3040b0, 0x4, 0x311933, 0x22, 0xc4313d3410)
        /Users/user/go/src/github.com/buaazp/fasthttprouter/router.go:210 +0xcc
github.com/buaazp/fasthttprouter.(*Router).POST(0xc4313d3320, 0x311933, 0x22, 0xc4313d3410)
        /Users/user/go/src/github.com/buaazp/fasthttprouter/router.go:169 +0x5e
@erikdubbelboer
Copy link

See julienschmidt#175 (comment)

@buaazp
Copy link
Owner

buaazp commented Mar 30, 2017

Maybe user_id or user_token in url query string or form data is a better practice.

r.POST("/user/actions/search", s)
r.POST("/user/collections/relations", addR)
r.DELETE("/user/collections/relations", removeR)
r.GET("/user", g)
r.POST("/user", a)
r.DELETE("/user",d)

http "localhost:80/user/actions/search?user_id=137118"

PS. thanks for your reply~ @erikdubbelboer

@buaazp buaazp closed this as completed May 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants