mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 18:07:01 +00:00
minor improvements
This commit is contained in:
@@ -708,9 +708,11 @@ func (api *APIBuilder) createRoutes(errorCode int, methods []string, relativePat
|
||||
errorCode = 0
|
||||
}
|
||||
|
||||
mainHandlers := context.CopyHandlers(handlers)
|
||||
|
||||
if errorCode == 0 {
|
||||
if len(methods) == 0 || methods[0] == "ALL" || methods[0] == "ANY" { // then use like it was .Any
|
||||
return api.Any(relativePath, handlers...)
|
||||
return api.Any(relativePath, mainHandlers...)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,7 +729,7 @@ func (api *APIBuilder) createRoutes(errorCode int, methods []string, relativePat
|
||||
filename, line := hero.GetCaller()
|
||||
|
||||
fullpath := api.relativePath + relativePath // for now, keep the last "/" if any, "/xyz/"
|
||||
if len(handlers) == 0 {
|
||||
if len(mainHandlers) == 0 {
|
||||
api.logger.Errorf("missing handlers for route[%s:%d] %s: %s", filename, line, strings.Join(methods, ", "), fullpath)
|
||||
return nil
|
||||
}
|
||||
@@ -751,12 +753,11 @@ func (api *APIBuilder) createRoutes(errorCode int, methods []string, relativePat
|
||||
beginHandlers = context.JoinHandlers(beginHandlers, api.middlewareErrorCode)
|
||||
}
|
||||
|
||||
mainHandlers := context.Handlers(handlers)
|
||||
// before join the middleware + handlers + done handlers and apply the execution rules.
|
||||
|
||||
mainHandlerName, mainHandlerIndex := context.MainHandlerName(mainHandlers)
|
||||
|
||||
mainHandlerFileName, mainHandlerFileNumber := context.HandlerFileLineRel(handlers[mainHandlerIndex])
|
||||
mainHandlerFileName, mainHandlerFileNumber := context.HandlerFileLineRel(mainHandlers[mainHandlerIndex])
|
||||
|
||||
// TODO: think of it.
|
||||
if mainHandlerFileName == "<autogenerated>" {
|
||||
|
||||
Reference in New Issue
Block a user