mirror of
https://github.com/labstack/echo.git
synced 2025-12-03 22:59:09 +02:00
18
router.go
18
router.go
@@ -275,8 +275,7 @@ func (n *node) check405() HandlerFunc {
|
||||
return notFoundHandler
|
||||
}
|
||||
|
||||
func (r *Router) Find(method, path string, context Context) (h HandlerFunc, e *Echo) {
|
||||
x := context.X()
|
||||
func (r *Router) Find(method, path string, x *context) (h HandlerFunc, e *Echo) {
|
||||
h = notFoundHandler
|
||||
e = r.echo
|
||||
cn := r.tree // Current node as root
|
||||
@@ -402,12 +401,11 @@ End:
|
||||
}
|
||||
|
||||
func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
// TODO: v2
|
||||
// c := r.echo.pool.Get().(*context)
|
||||
// h, _ := r.Find(req.Method, req.URL.Path, c)
|
||||
// c.reset(req, w, r.echo)
|
||||
// if err := h(c); err != nil {
|
||||
// r.echo.httpErrorHandler(err, c)
|
||||
// }
|
||||
// r.echo.pool.Put(c)
|
||||
c := r.echo.pool.Get().(*context)
|
||||
h, _ := r.Find(req.Method, req.URL.Path, c)
|
||||
c.reset(req, w, r.echo)
|
||||
if err := h(c); err != nil {
|
||||
r.echo.httpErrorHandler(err, c)
|
||||
}
|
||||
r.echo.pool.Put(c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user