mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Merge branch 'issues-77' into 'master'
Add app and route validation to calls API handler See merge request !77
This commit is contained in:
@@ -17,11 +17,23 @@ func (s *Server) handleCallList(c *gin.Context) {
|
||||
c.JSON(http.StatusBadRequest, models.ErrRoutesValidationMissingAppName)
|
||||
return
|
||||
}
|
||||
|
||||
_, err := s.Datastore.GetApp(c, appName)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusNotFound, models.ErrAppsNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
appRoute, ok := c.MustGet(api.Path).(string)
|
||||
if ok && appRoute == "" {
|
||||
c.JSON(http.StatusBadRequest, models.ErrRoutesValidationMissingPath)
|
||||
return
|
||||
}
|
||||
_, err = s.Datastore.GetRoute(c, appName, appRoute)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusNotFound, models.ErrRoutesNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
filter := models.CallFilter{AppName:appName, Path:appRoute}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user