From 999ad778c771960d47291677e06a98dcaf74b404 Mon Sep 17 00:00:00 2001 From: "zhangxu19830126@gmail.com" Date: Mon, 25 Dec 2017 22:11:40 +0800 Subject: [PATCH] fix: closure error --- http.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/http.go b/http.go index c5d5b9f..16c52db 100644 --- a/http.go +++ b/http.go @@ -45,23 +45,24 @@ func (s *httpServer) stop() error { func (s *httpServer) addHTTPEntrypoints(httpEntrypoints ...*httpEntrypoint) { for _, ep := range httpEntrypoints { + invoker := ep m := strings.ToUpper(ep.method) switch m { case echo.GET: s.server.GET(ep.path, func(c echo.Context) error { - return s.handleHTTP(c, ep) + return s.handleHTTP(c, invoker) }) case echo.PUT: s.server.PUT(ep.path, func(c echo.Context) error { - return s.handleHTTP(c, ep) + return s.handleHTTP(c, invoker) }) case echo.DELETE: s.server.DELETE(ep.path, func(c echo.Context) error { - return s.handleHTTP(c, ep) + return s.handleHTTP(c, invoker) }) case echo.POST: s.server.POST(ep.path, func(c echo.Context) error { - return s.handleHTTP(c, ep) + return s.handleHTTP(c, invoker) }) } }