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

non-wildcard and wildcard router conflict, why? #210

Closed
1046102779 opened this issue Jul 31, 2017 · 7 comments
Closed

non-wildcard and wildcard router conflict, why? #210

1046102779 opened this issue Jul 31, 2017 · 7 comments

Comments

@1046102779
Copy link
Contributor

image

@GuihToledo
Copy link

I have the same problem, looking the issues history, other peoples pointed this problem years ago, but have never fixed =/.

@shinriyo
Copy link

Me too.
It is inconvenience.

func (controller *ShopsController) Setup() {
        controller.Router.POST("/shops", controller.createShop)
        controller.Router.GET("/shops", controller.listShops)
        //controller.Router.GET("/shops/new", controller.newShop) // conflict!!
        controller.Router.GET("/shops/:shop_id", controller.getShop)
        controller.Router.GET("/shops/:shop_id/edit", controller.editShop)
        controller.Router.PUT("/shops/:shop_id", controller.updateShop)
        controller.Router.DELETE("/shops/:shop_id", controller.deleteShop)
}

I also use Group but conflict!

func (controller *ShopsController) Setup() {
        v1 := controller.Router.Group("/shops")
        {
                v1.POST("", controller.createShop)
                v1.GET("", controller.listShops)
                //v1.GET("/new", controller.newShop) // conflict!!
                v1.GET("/:shop_id", controller.getShop)
                v1.GET("/:shop_id/edit", controller.editShop)
                v1.PUT("/:shop_id", controller.updateShop)
                v1.DELETE("/:shop_id", controller.deleteShop)
        }
}

@shinriyo
Copy link

I guess /:hoge and /somthing are conflicts.

@joshuamzm
Copy link

#175

@ghost
Copy link

ghost commented Oct 27, 2017

I have an even stranger conflict:

router.GET("/:room/:screen/up", handler)
router.GET("/socket", handler)

I cannot fathom how this could be a conflict, since /socket would not match the pattern of the first route, since it misses part of the path.

Repository owner deleted a comment from andersfylling Oct 27, 2017
Repository owner deleted a comment from andersfylling Oct 27, 2017
Repository owner deleted a comment from zigo101 Jul 15, 2018
@yonderblue
Copy link

yonderblue commented Sep 6, 2018

For anyone else looking for a solution, https://godoc.org/github.com/dimfeld/httptreemux solves this problem, why it wasn't contributed back I am not sure though.

@julienschmidt
Copy link
Owner

Duplicate of #183

@julienschmidt julienschmidt marked this as a duplicate of #183 Sep 25, 2019
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

6 participants