snap/context.go

31 lines
414 B
Go
Raw Normal View History

2018-02-07 22:25:00 +00:00
package snap
import "net/http"
type Context struct {
Username string
srv *server
w http.ResponseWriter
r *http.Request
}
func (c *Context) GetRequest() *http.Request {
return c.r
}
func (c *Context) Writer() http.ResponseWriter {
return c.w
}
func (c *Context) GetUser() string {
return c.Username
}
func (c *Context) Render(tmpl string, content interface{}) {
c.srv.render(c.w, tmpl, content)
}