0

I am using a the emicklei/go-restful framework to deal with rest API. I wish to access the route path from the request. Meaning that when I configure a dummy route like this:

    ws := new(restful.WebService)
    ws.Path("/resources/names")
    ws.Route(ws.GET("/{name}").To(getName))
    restful.DefaultContainer.Add(ws)

I wish to access the information that the route was "/resources/names/{name}"

I can access the actual URL which is call by calling:

    req.Request.URL.Path

But this will return the specific URL, not the generic one.

Any suggestion?

Djoby
  • 602
  • 1
  • 6
  • 22

1 Answers1

0

After more research I finally found that the method req.SelectedRoutePath() will return expected value.

Djoby
  • 602
  • 1
  • 6
  • 22