5dee6b7d by astaxie

beego: fix the namespace cond

1 parent f6c7a6bd
...@@ -191,6 +191,7 @@ func (n *Namespace) ServeHTTP(rw http.ResponseWriter, r *http.Request) { ...@@ -191,6 +191,7 @@ func (n *Namespace) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
191 } 191 }
192 if n.condition != nil && !n.condition(context) { 192 if n.condition != nil && !n.condition(context) {
193 http.Error(rw, "Method Not Allowed", 405) 193 http.Error(rw, "Method Not Allowed", 405)
194 return
194 } 195 }
195 n.handlers.ServeHTTP(rw, r) 196 n.handlers.ServeHTTP(rw, r)
196 } 197 }
......
...@@ -763,6 +763,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -763,6 +763,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
763 if !findrouter { 763 if !findrouter {
764 for _, route := range p.fixrouters { 764 for _, route := range p.fixrouters {
765 n := len(requestPath) 765 n := len(requestPath)
766 if n == 0 {
767 continue
768 }
766 if requestPath == route.pattern { 769 if requestPath == route.pattern {
767 runMethod = p.getRunMethod(r.Method, context, route) 770 runMethod = p.getRunMethod(r.Method, context, route)
768 if runMethod != "" { 771 if runMethod != "" {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!