Added support for redirects

This commit is contained in:
Alexander Nyquist
2014-07-29 00:48:02 +02:00
parent c3abaf9afc
commit 593de4e913
3 changed files with 29 additions and 4 deletions
+5
View File
@@ -247,6 +247,11 @@ func (c *Context) String(code int, format string, values ...interface{}) {
c.Render(code, render.Plain, format, values)
}
// Returns a 302 redirect to the specific location.
func (c *Context) Redirect(location string, code int) {
c.Render(302, render.Redirect, location, code)
}
// Writes some data into the body stream and updates the HTTP code.
func (c *Context) Data(code int, contentType string, data []byte) {
if len(contentType) > 0 {