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)
}
浙公网安备 33010602011771号