Add Redirect to Context
This commit is contained in:
parent
a16ee2740c
commit
d30d304cea
@ -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{})}
|
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
|
// String returns the given status code and writes the bytes to the body
|
||||||
func (c *Context) Bytes(code int, b []byte) error {
|
func (c *Context) Bytes(code int, b []byte) error {
|
||||||
c.Response.WriteHeader(code)
|
c.Response.WriteHeader(code)
|
||||||
|
Loading…
Reference in New Issue
Block a user