code: func (l *LARS) wrapHandler(h Handler) HandlerFunc {
  
  	switch h := h.(type) {
  	case HandlerFunc:
  		return h
  
  	case func(Context):
  		return h
  
  	case http.Handler, http.HandlerFunc:
  		return func(c Context) {
  
  			ctx := c.BaseContext()
  
  			if h.(http.Handler).ServeHTTP(ctx.response, ctx.request); ctx.response.status != http.StatusOK || ctx.response.committed {
  				return
  			}
  
  			if ctx.index+1 < len(ctx.handlers) {
  				c.Next()
  			}
  		}
  
  	case func(http.ResponseWriter, *http.Request):
  		return func(c Context) {
  
  			ctx := c.BaseContext()
  
  			if h(ctx.response, ctx.request); ctx.response.status != http.StatusOK || ctx.response.committed {
  				return
  			}
  
  			if ctx.index+1 < len(ctx.handlers) {
  				c.Next()
  			}
  		}
  
  	case func(http.ResponseWriter, *http.Request, http.Handler):
  
  		return func(c Context) {
  			ctx := c.BaseContext()
  
  			h(ctx.response, ctx.request, NativeChainHandler)
  		}
  
  	case func(http.Handler) http.Handler:
  
  		hf := h(NativeChainHandler)
  
  		return func(c Context) {
  			ctx := c.BaseContext()
  
  			hf.ServeHTTP(ctx.response, ctx.request)
  		}
  
  	default:
  		if fn, ok := l.customHandlersFuncs[reflect.TypeOf(h)]; ok {
  			return func(c Context) {
  				fn(c, h)
  			}
  		}
  
  		panic("unknown handler")
  	}
  }
docs: // wrapHandler wraps Handler type