mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
修复控制器和执行对象绑定'/'路由的问题
This commit is contained in:
@ -40,6 +40,9 @@ func (s *Server)BindController(pattern string, c Controller, methods...string) e
|
||||
p := key
|
||||
if strings.EqualFold(p[len(p) - 6:], "/index") {
|
||||
p = p[0 : len(p) - 6]
|
||||
if len(p) == 0 {
|
||||
p = "/"
|
||||
}
|
||||
}
|
||||
m[p] = &handlerItem {
|
||||
ctype : v.Elem().Type(),
|
||||
@ -75,6 +78,9 @@ func (s *Server)BindControllerMethod(pattern string, c Controller, methods strin
|
||||
p := key
|
||||
if strings.EqualFold(p[len(p) - 6:], "/index") {
|
||||
p = p[0 : len(p) - 6]
|
||||
if len(p) == 0 {
|
||||
p = "/"
|
||||
}
|
||||
}
|
||||
m[p] = &handlerItem {
|
||||
ctype : t,
|
||||
|
||||
@ -36,6 +36,9 @@ func (s *Server)BindObject(pattern string, obj interface{}, methods...string) er
|
||||
p := key
|
||||
if strings.EqualFold(p[len(p) - 6:], "/index") {
|
||||
p = p[0 : len(p) - 6]
|
||||
if len(p) == 0 {
|
||||
p = "/"
|
||||
}
|
||||
}
|
||||
m[p] = &handlerItem {
|
||||
ctype : nil,
|
||||
@ -71,6 +74,9 @@ func (s *Server)BindObjectMethod(pattern string, obj interface{}, methods string
|
||||
p := key
|
||||
if strings.EqualFold(p[len(p) - 6:], "/index") {
|
||||
p = p[0 : len(p) - 6]
|
||||
if len(p) == 0 {
|
||||
p = "/"
|
||||
}
|
||||
}
|
||||
m[p] = &handlerItem {
|
||||
ctype : nil,
|
||||
|
||||
Reference in New Issue
Block a user