you can refer to golang chi opensource for middleware 在 2017年9月5日星期二 UTC+8下午11:13:40,Ilya Novikov写道: > > Hello!I would like to understand how middleware works in go-kit. I want to > write a middleware auth processor but do not understand how to describe the > logic of the process. > > That is, I need to take the cookie values from the context and perform the > rights check? After all, in middleware comes only context. Then another > question arises, what should mw return if access is denied? Thank you! > > > func authMW(methodName string) endpoint.Middleware { > return func(next endpoint.Endpoint) endpoint.Endpoint { > return func(ctx context.Context, request interface{}) (interface{}, > error) { > defer func(begin time.Time) { > //???? > return next(ctx, request) > } > } > } > >
-- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.