mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 04:20:55 +00:00
beego: fix the namespace cond
This commit is contained in:
parent
f6c7a6bd32
commit
5dee6b7d19
@ -191,6 +191,7 @@ func (n *Namespace) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
if n.condition != nil && !n.condition(context) {
|
if n.condition != nil && !n.condition(context) {
|
||||||
http.Error(rw, "Method Not Allowed", 405)
|
http.Error(rw, "Method Not Allowed", 405)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
n.handlers.ServeHTTP(rw, r)
|
n.handlers.ServeHTTP(rw, r)
|
||||||
}
|
}
|
||||||
|
@ -763,6 +763,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
|||||||
if !findrouter {
|
if !findrouter {
|
||||||
for _, route := range p.fixrouters {
|
for _, route := range p.fixrouters {
|
||||||
n := len(requestPath)
|
n := len(requestPath)
|
||||||
|
if n == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if requestPath == route.pattern {
|
if requestPath == route.pattern {
|
||||||
runMethod = p.getRunMethod(r.Method, context, route)
|
runMethod = p.getRunMethod(r.Method, context, route)
|
||||||
if runMethod != "" {
|
if runMethod != "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user