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

code style simplify for context package

This commit is contained in:
fuxiaohei 2015-02-23 11:15:55 +08:00
parent f988f035e5
commit 24cf06d288
2 changed files with 8 additions and 5 deletions

View File

@ -155,8 +155,11 @@ func (ctx *Context) CheckXsrfCookie() bool {
}
if token == "" {
ctx.Abort(403, "'_xsrf' argument missing from POST")
} else if ctx._xsrf_token != token {
return false
}
if ctx._xsrf_token != token {
ctx.Abort(403, "XSRF cookie does not match POST argument")
return false
}
return true
}

View File

@ -72,11 +72,11 @@ func (input *BeegoInput) Site() string {
func (input *BeegoInput) Scheme() string {
if input.Request.URL.Scheme != "" {
return input.Request.URL.Scheme
} else if input.Request.TLS == nil {
return "http"
} else {
return "https"
}
if input.Request.TLS == nil {
return "http"
}
return "https"
}
// Domain returns host name.