1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-24 05:17:03 +00:00

more route info improvements

Former-commit-id: ccbe95de0badb1bf448fcc443cecda60772716dc
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-04-28 22:34:36 +03:00
parent 128cd255cb
commit 2a4043a3c2
14 changed files with 147 additions and 61 deletions

View File

@@ -117,7 +117,15 @@ func (api *APIContainer) Done(handlersFn ...interface{}) {
// See `OnError`, `RegisterDependency`, `Use`, `Done`, `Get`, `Post`, `Put`, `Patch` and `Delete` too.
func (api *APIContainer) Handle(method, relativePath string, handlersFn ...interface{}) *Route {
handlers := api.convertHandlerFuncs(relativePath, handlersFn...)
return api.Self.Handle(method, relativePath, handlers...)
route := api.Self.Handle(method, relativePath, handlers...)
// Fix main handler name and source modified by execution rules wrapper.
route.MainHandlerName, route.MainHandlerIndex = context.MainHandlerName(handlersFn...)
if len(handlersFn) > route.MainHandlerIndex {
route.SourceFileName, route.SourceLineNumber = context.HandlerFileLineRel(handlersFn[route.MainHandlerIndex])
}
return route
}
// Get registers a route for the Get HTTP Method.