1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 00:00:54 +00:00

beego: fix the namespace cond

This commit is contained in:
astaxie 2014-05-28 10:23:31 +08:00
parent f6c7a6bd32
commit 5dee6b7d19
2 changed files with 4 additions and 0 deletions

View File

@ -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)
}

View File

@ -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 != "" {