3

I want to rewrite flask application in golang-gin, and i have a path problem in routes, :status have only 3 version start pause end , this is my current routes :

    contracts.POST("/:id/:status", s.contractChangeStatus)
    contracts.POST("/:id/events/:type", AccessRole(models.Work), s.eventCreate)

problem is when i execute app, return this error :

panic: path segment 'events/:type' conflicts with existing wildcard ':status' in path '/contracts/:id/events/:type'

what is the best practice for solve this situation ? in flask exist a simple path /any(start|pause|stop), how i can solve this in golang-gin ? without change api structure !

blackgreen
  • 34,072
  • 23
  • 111
  • 129
kodiu
  • 61
  • 2
  • 6
  • 2
    I would suggest taking a look at https://github.com/gin-gonic/gin/issues/205. Gin-gonic has had this problem for a while, and there appears to be workarounds. – H. Ross Feb 18 '19 at 21:21
  • Also, take a look at the answers for this question: https://stackoverflow.com/questions/52845807/gin-wildcard-route-conflicts-with-existing-children?rq=1 – H. Ross Feb 18 '19 at 21:32

0 Answers0