mirror of
https://github.com/astaxie/beego.git
synced 2024-11-26 07:01:28 +00:00
fix router & tpl tolower
This commit is contained in:
parent
bce35c708a
commit
8674b81b3a
@ -156,7 +156,7 @@ func (c *Controller) RenderBytes() ([]byte, error) {
|
|||||||
//if the controller has set layout, then first get the tplname's content set the content to the layout
|
//if the controller has set layout, then first get the tplname's content set the content to the layout
|
||||||
if c.Layout != "" {
|
if c.Layout != "" {
|
||||||
if c.TplNames == "" {
|
if c.TplNames == "" {
|
||||||
c.TplNames = c.ChildName + "/" + c.Ctx.Request.Method + "." + c.TplExt
|
c.TplNames = c.ChildName + "/" + strings.ToLower(c.Ctx.Request.Method) + "." + c.TplExt
|
||||||
}
|
}
|
||||||
if RunMode == "dev" {
|
if RunMode == "dev" {
|
||||||
BuildTemplate(ViewsPath)
|
BuildTemplate(ViewsPath)
|
||||||
|
@ -373,14 +373,15 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
|||||||
for _, route := range p.fixrouters {
|
for _, route := range p.fixrouters {
|
||||||
n := len(requestPath)
|
n := len(requestPath)
|
||||||
//route like "/"
|
//route like "/"
|
||||||
if n == 1 {
|
//if n == 1 {
|
||||||
|
// else {
|
||||||
|
// continue
|
||||||
|
// }
|
||||||
|
//}
|
||||||
if requestPath == route.pattern {
|
if requestPath == route.pattern {
|
||||||
runrouter = route
|
runrouter = route
|
||||||
findrouter = true
|
findrouter = true
|
||||||
break
|
break
|
||||||
} else {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestPath[n-1] != '/' && route.pattern == requestPath) ||
|
if (requestPath[n-1] != '/' && route.pattern == requestPath) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user