8674b81b by astaxie

fix router & tpl tolower

1 parent bce35c70
...@@ -156,7 +156,7 @@ func (c *Controller) RenderBytes() ([]byte, error) { ...@@ -156,7 +156,7 @@ func (c *Controller) RenderBytes() ([]byte, error) {
156 //if the controller has set layout, then first get the tplname's content set the content to the layout 156 //if the controller has set layout, then first get the tplname's content set the content to the layout
157 if c.Layout != "" { 157 if c.Layout != "" {
158 if c.TplNames == "" { 158 if c.TplNames == "" {
159 c.TplNames = c.ChildName + "/" + c.Ctx.Request.Method + "." + c.TplExt 159 c.TplNames = c.ChildName + "/" + strings.ToLower(c.Ctx.Request.Method) + "." + c.TplExt
160 } 160 }
161 if RunMode == "dev" { 161 if RunMode == "dev" {
162 BuildTemplate(ViewsPath) 162 BuildTemplate(ViewsPath)
......
...@@ -373,14 +373,15 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -373,14 +373,15 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
373 for _, route := range p.fixrouters { 373 for _, route := range p.fixrouters {
374 n := len(requestPath) 374 n := len(requestPath)
375 //route like "/" 375 //route like "/"
376 if n == 1 { 376 //if n == 1 {
377 if requestPath == route.pattern { 377 // else {
378 runrouter = route 378 // continue
379 findrouter = true 379 // }
380 break 380 //}
381 } else { 381 if requestPath == route.pattern {
382 continue 382 runrouter = route
383 } 383 findrouter = true
384 break
384 } 385 }
385 386
386 if (requestPath[n-1] != '/' && route.pattern == requestPath) || 387 if (requestPath[n-1] != '/' && route.pattern == requestPath) ||
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!