mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Allow calling root route on app
Fixes #64 Previously calling a root registered route would result in an error message "Not Found" suggesting the route hadn't been registed, yet when listing the routes, `fn routes list myapp` you could see the `/` route. You can now successfully call a root registered route with `fn call myapp /`
This commit is contained in:
@@ -94,9 +94,14 @@ func (s *Server) handleRequest(c *gin.Context, enqueue models.Enqueue) {
|
||||
payload = strings.NewReader(reqPayload)
|
||||
}
|
||||
|
||||
r, routeExists := c.Get(api.Path)
|
||||
if !routeExists {
|
||||
r = "/"
|
||||
}
|
||||
|
||||
reqRoute := &models.Route{
|
||||
AppName: c.MustGet(api.AppName).(string),
|
||||
Path: path.Clean(c.MustGet(api.Path).(string)),
|
||||
Path: path.Clean(r.(string)),
|
||||
}
|
||||
|
||||
s.FireBeforeDispatch(ctx, reqRoute)
|
||||
|
||||
Reference in New Issue
Block a user