remove gin, fix specialhandler and added test (#448)

This commit is contained in:
Pedro Nasser
2016-12-15 16:26:59 -02:00
committed by Travis Reeder
parent 1aea433d05
commit 63c2b18ac5
4 changed files with 83 additions and 49 deletions

View File

@@ -27,16 +27,15 @@ func (s *Server) handleSpecial(c *gin.Context) {
ctx = context.WithValue(ctx, "appName", "")
ctx = context.WithValue(ctx, "routePath", c.Request.URL.Path)
c.Set("ctx", ctx)
err := s.UseSpecialHandlers(c)
ctx, err := s.UseSpecialHandlers(ctx, c.Request, c.Writer)
if err != nil {
log.WithError(err).Errorln("Error using special handler!")
c.JSON(http.StatusInternalServerError, simpleError(errors.New("Failed to run function")))
return
}
ctx = c.MustGet("ctx").(context.Context)
c.Set("ctx", ctx)
if ctx.Value("appName").(string) == "" {
log.WithError(err).Errorln("Specialhandler returned empty app name")
c.JSON(http.StatusBadRequest, simpleError(models.ErrRunnerRouteNotFound))