fix router & tpl tolower
Showing
2 changed files
with
6 additions
and
5 deletions
| ... | @@ -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 | // else { | ||
| 378 | // continue | ||
| 379 | // } | ||
| 380 | //} | ||
| 377 | if requestPath == route.pattern { | 381 | if requestPath == route.pattern { |
| 378 | runrouter = route | 382 | runrouter = route |
| 379 | findrouter = true | 383 | findrouter = true |
| 380 | break | 384 | break |
| 381 | } else { | ||
| 382 | continue | ||
| 383 | } | ||
| 384 | } | 385 | } |
| 385 | 386 | ||
| 386 | if (requestPath[n-1] != '/' && route.pattern == requestPath) || | 387 | if (requestPath[n-1] != '/' && route.pattern == requestPath) || | ... | ... |
-
Please register or sign in to post a comment