mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Use chi style middle ware
This commit is contained in:
committed by
Travis Reeder
parent
570e9265f1
commit
cf2c3cf404
@@ -28,21 +28,21 @@ type runnerResponse struct {
|
||||
}
|
||||
|
||||
func (s *Server) handleSpecial(c *gin.Context) {
|
||||
ctx := c.MustGet("ctx").(context.Context)
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ctx = context.WithValue(ctx, api.AppName, "")
|
||||
c.Set(api.AppName, "")
|
||||
ctx = context.WithValue(ctx, api.Path, c.Request.URL.Path)
|
||||
c.Set(api.Path, c.Request.URL.Path)
|
||||
|
||||
ctx, err := s.UseSpecialHandlers(ctx, c.Request, c.Writer)
|
||||
r, err := s.UseSpecialHandlers(c.Writer, c.Request)
|
||||
if err != nil {
|
||||
handleErrorResponse(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
c.Set("ctx", ctx)
|
||||
c.Set(api.AppName, ctx.Value(api.AppName).(string))
|
||||
c.Request = r
|
||||
c.Set(api.AppName, r.Context().Value(api.AppName).(string))
|
||||
if c.MustGet(api.AppName).(string) == "" {
|
||||
handleErrorResponse(c, models.ErrRunnerRouteNotFound)
|
||||
return
|
||||
@@ -66,7 +66,7 @@ func (s *Server) handleRequest(c *gin.Context, enqueue models.Enqueue) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx := c.MustGet("ctx").(context.Context)
|
||||
ctx := c.Request.Context()
|
||||
|
||||
reqID := id.New().String()
|
||||
ctx, log := common.LoggerWithFields(ctx, logrus.Fields{"call_id": reqID})
|
||||
|
||||
Reference in New Issue
Block a user