31 lines
414 B
Go
31 lines
414 B
Go
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)
|
|
}
|
|
|