convertHandlerFuncs accepts Iris hero handlers and returns a slice of native Iris handlers.
(relativePath string, handlersFn ...interface{})
| 118 | |
| 119 | // convertHandlerFuncs accepts Iris hero handlers and returns a slice of native Iris handlers. |
| 120 | func (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 | |
| 139 | func fixRouteInfo(route *Route, handlersFn []interface{}) { |
| 140 | // Fix main handler name and source modified by execution rules wrapper. |
no test coverage detected