MCPcopy Create free account
hub / github.com/kataras/iris / MiddlewareExists

Method MiddlewareExists

core/router/api_builder.go:1374–1391  ·  view source on GitHub ↗

MiddlewareExists reports whether the given handler exists in the middleware chain.

(handlerNameOrFunc any)

Source from the content-addressed store, hash-verified

1372
1373// MiddlewareExists reports whether the given handler exists in the middleware chain.
1374func (api *APIBuilder) MiddlewareExists(handlerNameOrFunc any) bool {
1375 if handlerNameOrFunc == nil {
1376 return false
1377 }
1378
1379 var handlers context.Handlers
1380
1381 if filter, ok := api.routerFilters[api]; ok {
1382 handlers = append(handlers, filter.Handlers...)
1383 }
1384
1385 handlers = append(handlers, api.middleware...)
1386 handlers = append(handlers, api.doneHandlers...)
1387 handlers = append(handlers, api.beginGlobalHandlers...)
1388 handlers = append(handlers, api.doneGlobalHandlers...)
1389
1390 return context.HandlerExists(handlers, handlerNameOrFunc)
1391}
1392
1393// RemoveHandler deletes a handler from begin and done handlers
1394// based on its name or the handler pc function.

Callers

nothing calls this directly

Calls 1

HandlerExistsFunction · 0.92

Tested by

no test coverage detected