test := r.Group("/api/v1/test")
{
	test.POST("/:user_id/test_create", controllers.TestCreate)
	test.POST("/:id/send", controllers.Send)
}

  

上面代码会报错"':id' in new path 'x/:id/x' conflicts...

原因是同一个Group下,相同位置的参数名称需要一致,上面代码中,存在 :user_id 和 :id 两个参数名,所以报错,调整为一样的参数名称即可。

 

test := r.Group("/api/v1/test")
{
	test.POST("/:user_id/test_create", controllers.TestCreate)
	test.POST("/:user_id/send", controllers.Send)
}

  

 

posted on 2022-08-18 15:05  Boom__Clap  阅读(59)  评论(0编辑  收藏  举报