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

Open
1046102779 opened this Issue Jul 31, 2017 · 6 comments

Comments

Projects
None yet
5 participants
@1046102779

1046102779 commented Jul 31, 2017

image

@GuihToledo

This comment has been minimized.

Show comment
Hide comment
@GuihToledo

GuihToledo Aug 18, 2017

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

GuihToledo commented Aug 18, 2017

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

@shinriyo

This comment has been minimized.

Show comment
Hide comment
@shinriyo

shinriyo Sep 18, 2017

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 commented Sep 18, 2017

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

This comment has been minimized.

Show comment
Hide comment
@shinriyo

shinriyo Sep 18, 2017

I guess /:hoge and /somthing are conflicts.

shinriyo commented Sep 18, 2017

I guess /:hoge and /somthing are conflicts.

@jomendoz

This comment has been minimized.

Show comment
Hide comment
@jomendoz

jomendoz commented Oct 16, 2017

#175

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost 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.

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 go101 Jul 15, 2018

@gaillard

This comment has been minimized.

Show comment
Hide comment
@gaillard

gaillard 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.

gaillard 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment