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

Method convertHandlerFuncs

core/router/api_container.go:120–137  ·  view source on GitHub ↗

convertHandlerFuncs accepts Iris hero handlers and returns a slice of native Iris handlers.

(relativePath string, handlersFn ...interface{})

Source from the content-addressed store, hash-verified

118
119// convertHandlerFuncs accepts Iris hero handlers and returns a slice of native Iris handlers.
120func (api *APIContainer) convertHandlerFuncs(relativePath string, handlersFn ...interface{}) context.Handlers {
121 fullpath := api.Self.GetRelPath() + relativePath
122 paramsCount := macro.CountParams(fullpath, *api.Self.Macros())
123
124 handlers := make(context.Handlers, 0, len(handlersFn))
125 for _, h := range handlersFn {
126 handlers = append(handlers, api.Container.HandlerWithParams(h, paramsCount))
127 }
128
129 // Note: let end-developer to decide that through Party.SetExecutionRules.
130 // On that type of handlers the end-developer does not have to include the Context in the handler,
131 // so the ctx.Next is automatically called unless an `ErrStopExecution` returned (implementation inside hero pkg).
132 //
133 // o := ExecutionOptions{Force: true}
134 // o.apply(&handlers)
135
136 return handlers
137}
138
139func fixRouteInfo(route *Route, handlersFn []interface{}) {
140 // Fix main handler name and source modified by execution rules wrapper.

Callers 5

PartyMethod · 0.95
UseMethod · 0.95
DoneMethod · 0.95
HandleMethod · 0.95
AnyMethod · 0.95

Calls 4

CountParamsFunction · 0.92
HandlerWithParamsMethod · 0.80
GetRelPathMethod · 0.65
MacrosMethod · 0.65

Tested by

no test coverage detected