|
@@ -45,6 +45,14 @@ func (c *Context) Success(val interface{}) (err error) {
|
|
|
return c.JSON(&Response{Result: val})
|
|
|
}
|
|
|
|
|
|
+func (c *Context) Redirect(url string, code int) {
|
|
|
+ http.Redirect(c.Response(), c.Request(), url, code)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Context) SetCookie(cookie *http.Cookie) {
|
|
|
+ http.SetCookie(c.Response(), cookie)
|
|
|
+}
|
|
|
+
|
|
|
func (c *Context) GetRealIp() string {
|
|
|
if ip := c.Request().Header.Get("X-Forwarded-For"); ip != "" {
|
|
|
i := strings.IndexAny(ip, ",")
|