Commit 5dee6b7d authored by astaxie's avatar astaxie

beego: fix the namespace cond

parent f6c7a6bd
......@@ -191,6 +191,7 @@ func (n *Namespace) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
}
if n.condition != nil && !n.condition(context) {
http.Error(rw, "Method Not Allowed", 405)
return
}
n.handlers.ServeHTTP(rw, r)
}
......
......@@ -763,6 +763,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
if !findrouter {
for _, route := range p.fixrouters {
n := len(requestPath)
if n == 0 {
continue
}
if requestPath == route.pattern {
runMethod = p.getRunMethod(r.Method, context, route)
if runMethod != "" {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment