00020139 by Pengfei Xue

fix routing bug

1 parent 1c434dc6
...@@ -574,9 +574,11 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -574,9 +574,11 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
574 n := len(requestPath) 574 n := len(requestPath)
575 if requestPath == route.pattern { 575 if requestPath == route.pattern {
576 runrouter = route.controllerType 576 runrouter = route.controllerType
577 findrouter = true
578 runMethod = p.getRunMethod(r.Method, context, route) 577 runMethod = p.getRunMethod(r.Method, context, route)
579 break 578 if runMethod != "" {
579 findrouter = true
580 break
581 }
580 } 582 }
581 // pattern /admin url /admin 200 /admin/ 404 583 // pattern /admin url /admin 200 /admin/ 404
582 // pattern /admin/ url /admin 301 /admin/ 200 584 // pattern /admin/ url /admin 301 /admin/ 200
...@@ -616,10 +618,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -616,10 +618,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
616 r.URL.RawQuery = url.Values(values).Encode() 618 r.URL.RawQuery = url.Values(values).Encode()
617 } 619 }
618 runrouter = route.controllerType 620 runrouter = route.controllerType
619 findrouter = true
620 context.Input.Params = params 621 context.Input.Params = params
621 runMethod = p.getRunMethod(r.Method, context, route) 622 runMethod = p.getRunMethod(r.Method, context, route)
622 break 623 if runMethod != "" {
624 findrouter = true
625 break
626 }
623 } 627 }
624 } 628 }
625 629
...@@ -801,9 +805,8 @@ func (p *ControllerRegistor) getRunMethod(method string, context *beecontext.Con ...@@ -801,9 +805,8 @@ func (p *ControllerRegistor) getRunMethod(method string, context *beecontext.Con
801 return m 805 return m
802 } else if m, ok = router.methods["*"]; ok { 806 } else if m, ok = router.methods["*"]; ok {
803 return m 807 return m
804 } else {
805 return strings.Title(method)
806 } 808 }
809 return ""
807 } else { 810 } else {
808 return strings.Title(method) 811 return strings.Title(method)
809 } 812 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!