iris icon indicating copy to clipboard operation
iris copied to clipboard

about RemoveHandler again

Open sado0823 opened this issue 4 years ago • 2 comments

hi @kataras , another question here !

this case can remove handler successful

func Route(r router.Party) {
                r.Use(middleware.Foo)
		r.Get("/foo", ctrl.Index).RemoveHandler(middleware.Foo)
}

but this case failed

func Route(r *iris.APIContainer) {
		sub := r.Party("/sub-r")
                sub.Use(middleware.Foo)
		sub.Get("/foo", ctrl.Index).RemoveHandler(middleware.Foo)
}

the difference is r router.Party and r *iris.APIContainer

image

and i find that middleware.Foo do not in r.Handlers

actually the handler that use in app.UseGlobal(...) can find in this r.Handlers ,

It bothers me a lot, and i think it is a bug, all the handlers shoud be added to []Handler

Originally posted by @sado0823 in https://github.com/kataras/iris/issues/1713#issuecomment-786394147

sado0823 avatar Feb 26 '21 03:02 sado0823

this change the original handlers, and set it to doneHandlers, when removeHandlers, it can not find the original handlers

image

sado0823 avatar Feb 26 '21 05:02 sado0823

@kataras is this a problem?

sado0823 avatar Mar 02 '21 01:03 sado0823