1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-09 12:20:18 +00:00

error support controller

This commit is contained in:
astaxie
2015-02-26 23:34:43 +08:00
parent 71b9854f48
commit 3aceaf8838
8 changed files with 167 additions and 170 deletions

View File

@ -19,7 +19,6 @@ import (
"strings"
beecontext "github.com/astaxie/beego/context"
"github.com/astaxie/beego/middleware"
)
type namespaceCond func(*beecontext.Context) bool
@ -57,7 +56,7 @@ func NewNamespace(prefix string, params ...innnerNamespace) *Namespace {
func (n *Namespace) Cond(cond namespaceCond) *Namespace {
fn := func(ctx *beecontext.Context) {
if !cond(ctx) {
middleware.Exception("405", ctx.ResponseWriter, ctx.Request, "Method not allowed")
exception("405", ctx)
}
}
if v, ok := n.handlers.filters[BeforeRouter]; ok {