kataras / kataras/iris

about RemoveHandler again

Open
#1,735 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
25.6k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

hi @kataras , another question here !

this case can remove handler successful
```golang
func Route(r router.Party) {
r.Use(middleware.Foo)
r.Get("/foo", ctrl.Index).RemoveHandler(middleware.Foo)
}
```

but this case failed
```golang
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](https://user-images.githubusercontent.com/51654192/109252467-917f5c00-7828-11eb-98f6-efc03787ec3b.png)

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_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the two routing examples in the issue and compare the handlers returned by r.Handlers for router.Party versus *iris.APIContainer. Trace RemoveHandler and app.UseGlobal behavior from those entry points; done means middleware.Foo can be found and removed consistently in both cases, with regression coverage for each example.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.