1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-02 23:33:27 +00:00
Beego/beehttp/context.go
2013-08-21 13:24:44 +08:00

30 lines
621 B
Go

package beehttp
import (
"net/http"
)
type Context struct {
Input *BeegoInput
Output *BeegoOutput
Request *http.Request
ResponseWriter http.ResponseWriter
}
func (ctx *Context) Redirect(status int, localurl string) {
ctx.Output.Header("Location", localurl)
ctx.Output.SetStatus(status)
}
func (ctx *Context) WriteString(content string) {
ctx.Output.Body([]byte(content))
}
func (ctx *Context) GetCookie(key string) string {
return ctx.Input.Cookie(key)
}
func (ctx *Context) SetCookie(name string, value string, others ...interface{}) {
ctx.Output.Cookie(name, value, others...)
}