mirror of
https://github.com/astaxie/beego.git
synced 2024-12-25 13:20:49 +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) {
|
||||
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 != "" {
|
||||
|
Loading…
Reference in New Issue
Block a user