mirror of
https://github.com/labstack/echo.git
synced 2025-07-05 00:58:47 +02:00
Fix for #681
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:
4
echo.go
4
echo.go
@ -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
|
||||||
|
Reference in New Issue
Block a user