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

Function MainHandlerName

context/handler.go:212–239  ·  view source on GitHub ↗

MainHandlerName tries to find the main handler that end-developer registered on the provided chain of handlers and returns its function name.

(handlers ...interface{})

Source from the content-addressed store, hash-verified

210// MainHandlerName tries to find the main handler that end-developer
211// registered on the provided chain of handlers and returns its function name.
212func MainHandlerName(handlers ...interface{}) (name string, index int) {
213 if len(handlers) == 0 {
214 return
215 }
216
217 if hs, ok := handlers[0].(Handlers); ok {
218 tmp := make([]interface{}, 0, len(hs))
219 for _, h := range hs {
220 tmp = append(tmp, h)
221 }
222
223 return MainHandlerName(tmp...)
224 }
225
226 for i := 0; i < len(handlers); i++ {
227 name = HandlerName(handlers[i])
228 if name == "" {
229 continue
230 }
231
232 index = i
233 if !ingoreMainHandlerName(name) {
234 break
235 }
236 }
237
238 return
239}
240
241func trimHandlerName(name string) string {
242 // trim the path for Iris' internal middlewares, e.g.

Callers 2

createRoutesMethod · 0.92
fixRouteInfoFunction · 0.92

Calls 2

HandlerNameFunction · 0.85
ingoreMainHandlerNameFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…