move from beehttp to context

This commit is contained in:
astaxie
2013-08-21 17:59:31 +08:00
parent d2be74a4f2
commit ac8853dfd3
4 changed files with 3 additions and 3 deletions

29
context/context.go Normal file
View File

@@ -0,0 +1,29 @@
package context
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...)
}