Last middleware should use the request passed by preceding middleware. (#965)

This is useful when preceding middleware reads httpRequest.Body to
perform some logic, and assigns a new ReadCloser to httpRequest.Body
(as body can be read only once).
This commit is contained in:
Srinidhi Chokkadi Puranik
2018-04-30 13:13:24 -07:00
committed by Reed Allman
parent 1124c014ec
commit e0b82519aa
2 changed files with 22 additions and 1 deletions

View File

@@ -93,7 +93,7 @@ func (s *Server) runMiddleware(c *gin.Context, ms []fnext.Middleware) {
c.Abort()
return
}
c.Request = c.Request.WithContext(ctx)
c.Request = r.WithContext(ctx)
c.Next()
})