Per route api extensions (#542)

* Extend extension mechanism to support per-route API extensions

* Tidy up comment

* Remove print statement

* Minor improvement to README

* Avoid calling c.Request.Context() twice
This commit is contained in:
Nigel Deakin
2017-11-29 12:03:23 +00:00
committed by GitHub
parent 4f72a1201f
commit 9a75785cbf
5 changed files with 80 additions and 7 deletions

View File

@@ -12,8 +12,7 @@ func (s *Server) handleRouteGet(c *gin.Context) {
ctx := c.Request.Context()
appName := c.MustGet(api.AppName).(string)
routePath := path.Clean(c.MustGet(api.Path).(string))
routePath := path.Clean("/" + c.MustGet(api.Path).(string))
route, err := s.Datastore.GetRoute(ctx, appName, routePath)
if err != nil {
handleErrorResponse(c, err)