MCPcopy Index your code
hub / github.com/labstack/echo / WrapHandler

Function WrapHandler

echo.go:821–832  ·  view source on GitHub ↗

WrapHandler wraps `http.Handler` into `echo.HandlerFunc`.

(h http.Handler)

Source from the content-addressed store, hash-verified

819
820// WrapHandler wraps `http.Handler` into `echo.HandlerFunc`.
821func WrapHandler(h http.Handler) HandlerFunc {
822 return func(c *Context) error {
823 req := c.Request()
824 req.Pattern = c.Path()
825 for _, p := range c.PathValues() {
826 req.SetPathValue(p.Name, p.Value)
827 }
828
829 h.ServeHTTP(c.Response(), req)
830 return nil
831 }
832}
833
834// WrapMiddleware wraps `func(http.Handler) http.Handler` into `echo.MiddlewareFunc`
835func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc {

Callers 1

TestEchoWrapHandlerFunction · 0.85

Calls 5

RequestMethod · 0.80
PathMethod · 0.80
PathValuesMethod · 0.80
ServeHTTPMethod · 0.80
ResponseMethod · 0.80

Tested by 1

TestEchoWrapHandlerFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…