Add Redirect to Context

This commit is contained in:
Nise Void 2018-11-30 14:24:28 +01:00
parent a16ee2740c
commit d30d304cea
Signed by: NiseVoid
GPG Key ID: FBA14AC83EA602F3
1 changed files with 5 additions and 0 deletions

View File

@ -20,6 +20,11 @@ func newContext(router *Router, res http.ResponseWriter, req *http.Request, para
return &Context{router, req, res, param.ByName, make(map[string]interface{})}
}
func (c *Context) Redirect(code int, url string) error {
http.Redirect(c.Response, c.Request, url, code)
return nil
}
// String returns the given status code and writes the bytes to the body
func (c *Context) Bytes(code int, b []byte) error {
c.Response.WriteHeader(code)