func Middleware(h func(http.Handler) http.Handler) middleware.Handler { return middleware.HandlerFunc(func(c context.Context, w http.ResponseWriter, r *http.Request) context.Context { h(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { gogo.Next(c, w, r) })).ServeHTTP(w, r) return nil }) }
// New returns session middleware func New(name string, store gorillaSessions.Store) middleware.Handler { return middleware.HandlerFunc(func(c context.Context, w http.ResponseWriter, r *http.Request) context.Context { session, _ := store.Get(r, sessionName) c = context.WithValue(c, storeKey, store) // gogo.Session(c).Values["foo"] return c }) }
func voidMiddlewareNode() middlewareNode { return middlewareNode{ handler: middleware.HandlerFunc(func(c context.Context, w http.ResponseWriter, r *http.Request) context.Context { return nil }), next: nil, } }
func MiddlewareFromRouterHandler(h Handler) middleware.Handler { return middleware.HandlerFunc(func(c context.Context, w http.ResponseWriter, r *http.Request) context.Context { h.ServeHTTP(c, w, r) return nil }) }
func (s *Server) UseFunc(h middleware.HandlerFunc) { s.Use(middleware.HandlerFunc(h)) }