forked from mirror/gin
Removed redundancy when redirecting
This commit is contained in:
parent
2c4460d7cc
commit
e350ae7c7e
|
@ -249,7 +249,7 @@ func (c *Context) String(code int, format string, values ...interface{}) {
|
||||||
|
|
||||||
// Returns a HTTP redirect to the specific location.
|
// Returns a HTTP redirect to the specific location.
|
||||||
func (c *Context) Redirect(location string, code int) {
|
func (c *Context) Redirect(location string, code int) {
|
||||||
c.Render(code, render.Redirect, location, code)
|
c.Render(code, render.Redirect, location)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Writes some data into the body stream and updates the HTTP code.
|
// Writes some data into the body stream and updates the HTTP code.
|
||||||
|
|
|
@ -53,7 +53,7 @@ func (_ jsonRender) Render(w http.ResponseWriter, code int, data ...interface{})
|
||||||
|
|
||||||
func (_ redirectRender) Render(w http.ResponseWriter, code int, data ...interface{}) error {
|
func (_ redirectRender) Render(w http.ResponseWriter, code int, data ...interface{}) error {
|
||||||
w.Header().Set("Location", data[0].(string))
|
w.Header().Set("Location", data[0].(string))
|
||||||
w.WriteHeader(data[1].(int))
|
w.WriteHeader(code)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue