1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-22 20:06:21 +02:00
Premiddleware may embed the echo context in their own custom context.  Therefore, it’s important to pass the context flowing down from the premiddleware chain down through the rest of the chain.
This commit is contained in:
Russ Egan 2016-10-21 14:08:56 -04:00
parent 7899588eff
commit 76125a53e5

View File

@ -545,7 +545,7 @@ func (e *Echo) ServeHTTP(req engine.Request, res engine.Response) {
c.Reset(req, res) c.Reset(req, res)
// Middleware // Middleware
h := func(Context) error { h := func(carg Context) error {
method := req.Method() method := req.Method()
path := req.URL().Path() path := req.URL().Path()
e.router.Find(method, path, c) e.router.Find(method, path, c)
@ -553,7 +553,7 @@ func (e *Echo) ServeHTTP(req engine.Request, res engine.Response) {
for i := len(e.middleware) - 1; i >= 0; i-- { for i := len(e.middleware) - 1; i >= 0; i-- {
h = e.middleware[i](h) h = e.middleware[i](h)
} }
return h(c) return h(carg)
} }
// Premiddleware // Premiddleware