// HandlerFunc sets the httpx.Handler for this route.
762551
func (r *Route) HandlerFunc(f func(context.Context, http.ResponseWriter, *http.Request) error) *Route {
	return r.Handler(HandlerFunc(f))
}
903233
func (f HandlerFunc) Handle(c *Client, m *Message) {
	f(c, m)
}
518065
func (s *Secure) HandlerFuncWithNext(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
	// Let secure process the request. If it returns an error,
	// that indicates the request should not continue.
	responseHeader, r, err := s.processRequest(w, r)
	addResponseHeaders(responseHeader, w)

	// If there was an error, do not call next.
	if err == nil && next != nil {
		next(w, r)
	}
}
1135239
func (h HandlerFunc) Handle(data json.RawMessage, ctx *apex.Context) (interface{}, error) {
	var event Event

	if err := json.Unmarshal(data, &event); err != nil {
		return nil, err
	}

	return nil, h(&event, ctx)
}
980132
func (r *router) addFunc(methods []string, url string, c interface{}, handlers []Handler) {
	vc := reflect.ValueOf(c)
	t := vc.Type()
	var rt RouteType

	if t.NumIn() == 0 {
		rt = FuncRoute
	} else if t.NumIn() == 1 {
		if t.In(0) == reflect.TypeOf(new(Context)) {
			rt = FuncCtxRoute
		} else if t.In(0) == reflect.TypeOf(new(http.Request)) {
			rt = FuncReqRoute
		} else if t.In(0).Kind() == reflect.Interface && t.In(0).Name() == "ResponseWriter" &&
			t.In(0).PkgPath() == "net/http" {
			rt = FuncResponseRoute
		} else {
			panic(fmt.Sprintln("no support function type", methods, url, c))
		}
	} else if t.NumIn() == 2 &&
		(t.In(0).Kind() == reflect.Interface && t.In(0).Name() == "ResponseWriter" &&
			t.In(0).PkgPath() == "net/http") &&
		t.In(1) == reflect.TypeOf(new(http.Request)) {
		rt = FuncHTTPRoute
	} else {
		panic(fmt.Sprintln("no support function type", methods, url, c))
	}

	url = removeStick(url)
	for _, m := range methods {
		r.addRoute(m, url, NewRoute(c, t, vc, rt, handlers))
	}
}
376339
func (msm *MultistreamMuxer) AddHandlerWithFunc(protocol string, match func(string) bool, handler HandlerFunc) {
	msm.handlerlock.Lock()
	defer msm.handlerlock.Unlock()

	msm.removeHandler(protocol)
	msm.handlers = append(msm.handlers, Handler{
		MatchFunc: match,
		Handle:    handler,
		AddName:   protocol,
	})
}
117710
func (r *Route) HeadFunc(f http.HandlerFunc) *Route {
	return r.Head(http.HandlerFunc(f))
}
197486
func (n *Negroni) UseFunc(handlerFunc func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)) {
	n.Use(HandlerFunc(handlerFunc))
}
1256837
func (mux *TypeMux) HandleFunc(t Type, f HandlerFunc) {
	mux.Handle(t, f)
}
825875
func FileHandlerFunc(filePath string) func(http.ResponseWriter, *http.Request) {
	return func(responseWriter http.ResponseWriter, request *http.Request) {
		http.ServeFile(responseWriter, request, filePath)
	}
}
1220554
func (sm *ServeMux) HandlerFunc(handler func(http.ResponseWriter, *http.Request) error) http.Handler {
	if sm.recoverPanic {
		return sm.MWErrorPanic(handler)
	}
	return sm.MWError(handler)
}
1027545
func (m *Mux) HandleFuncC(p Pattern, h func(context.Context, http.ResponseWriter, *http.Request)) {
	m.HandleC(p, HandlerFunc(h))
}
819333
func (r *Router) HandleFunc(path string, handler http.HandlerFunc, httpMethods ...string) *Trie {
	return r.Handle(path, handler, httpMethods...)
}
818691
func (mw *GinJWTMiddleware) MiddlewareFunc() gin.HandlerFunc {
	return func(c *gin.Context) {
		mw.middlewareImpl(c)
	}
}
960686
func (r *Route) ConnectFunc(f http.HandlerFunc) *Route {
	return r.Connect(http.HandlerFunc(f))
}
963711
func (r *Router) OptionsFunc(pattern string, fn http.HandlerFunc) Route {
	return r.Options(pattern, http.HandlerFunc(fn))
}
701031
func (d *Descriptor) HandleReadFunc(f func(rsp ResponseWriter, req *ReadRequest)) {
	d.HandleRead(ReadHandlerFunc(f))
}