From 8674b81b3a935a3bb48862032f1326df8eecb784 Mon Sep 17 00:00:00 2001 From: astaxie Date: Tue, 30 Jul 2013 22:17:16 +0800 Subject: [PATCH] fix router & tpl tolower --- controller.go | 2 +- router.go | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/controller.go b/controller.go index 4dd89a81..9dd737f9 100644 --- a/controller.go +++ b/controller.go @@ -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 c.Layout != "" { 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" { BuildTemplate(ViewsPath) diff --git a/router.go b/router.go index 2d00f061..fa2c1d37 100644 --- a/router.go +++ b/router.go @@ -373,14 +373,15 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) for _, route := range p.fixrouters { n := len(requestPath) //route like "/" - if n == 1 { - if requestPath == route.pattern { - runrouter = route - findrouter = true - break - } else { - continue - } + //if n == 1 { + // else { + // continue + // } + //} + if requestPath == route.pattern { + runrouter = route + findrouter = true + break } if (requestPath[n-1] != '/' && route.pattern == requestPath) ||