beego: fix the namespace cond
Showing
2 changed files
with
4 additions
and
0 deletions
| ... | @@ -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 != "" { | ... | ... |
-
Please register or sign in to post a comment