(c *gin.Context)
| 29 | } |
| 30 | |
| 31 | func (s *Server) handleSpecial(c *gin.Context) { |
| 32 | ctx := c.MustGet("ctx").(context.Context) |
| 33 | log := common.Logger(ctx) |
| 34 | |
| 35 | ctx = context.WithValue(ctx, api.AppName, "") |
| 36 | c.Set(api.AppName, "") |
| 37 | ctx = context.WithValue(ctx, api.Path, c.Request.URL.Path) |
| 38 | c.Set(api.Path, c.Request.URL.Path) |
| 39 | |
| 40 | ctx, err := s.UseSpecialHandlers(ctx, c.Request, c.Writer) |
| 41 | if err == ErrNoSpecialHandlerFound { |
| 42 | log.WithError(err).Errorln("Not special handler found") |
| 43 | c.JSON(http.StatusNotFound, http.StatusText(http.StatusNotFound)) |
| 44 | return |
| 45 | } else if err != nil { |
| 46 | log.WithError(err).Errorln("Error using special handler!") |
| 47 | c.JSON(http.StatusInternalServerError, simpleError(errors.New("Failed to run function"))) |
| 48 | return |
| 49 | } |
| 50 | |
| 51 | c.Set("ctx", ctx) |
| 52 | c.Set(api.AppName, ctx.Value(api.AppName).(string)) |
| 53 | if c.MustGet(api.AppName).(string) == "" { |
| 54 | log.WithError(err).Errorln("Specialhandler returned empty app name") |
| 55 | c.JSON(http.StatusBadRequest, simpleError(models.ErrRunnerRouteNotFound)) |
| 56 | return |
| 57 | } |
| 58 | |
| 59 | // now call the normal runner call |
| 60 | s.handleRequest(c, nil) |
| 61 | } |
| 62 | |
| 63 | func toEnvName(envtype, name string) string { |
| 64 | name = strings.ToUpper(strings.Replace(name, "-", "_", -1)) |
nothing calls this directly
no test coverage detected