fix setcookie time type
Showing
1 changed file
with
7 additions
and
0 deletions
| ... | @@ -72,7 +72,14 @@ func (ctx *Context) SetCookie(name string, value string, others ...interface{}) | ... | @@ -72,7 +72,14 @@ func (ctx *Context) SetCookie(name string, value string, others ...interface{}) |
| 72 | var b bytes.Buffer | 72 | var b bytes.Buffer |
| 73 | fmt.Fprintf(&b, "%s=%s", sanitizeName(name), sanitizeValue(value)) | 73 | fmt.Fprintf(&b, "%s=%s", sanitizeName(name), sanitizeValue(value)) |
| 74 | if len(others) > 0 { | 74 | if len(others) > 0 { |
| 75 | switch others[0].(type) { | ||
| 76 | case int: | ||
| 77 | fmt.Fprintf(&b, "; Max-Age=%d", others[0].(int)) | ||
| 78 | case int64: | ||
| 75 | fmt.Fprintf(&b, "; Max-Age=%d", others[0].(int64)) | 79 | fmt.Fprintf(&b, "; Max-Age=%d", others[0].(int64)) |
| 80 | case int32: | ||
| 81 | fmt.Fprintf(&b, "; Max-Age=%d", others[0].(int32)) | ||
| 82 | } | ||
| 76 | } else { | 83 | } else { |
| 77 | fmt.Fprintf(&b, "; Max-Age=0") | 84 | fmt.Fprintf(&b, "; Max-Age=0") |
| 78 | } | 85 | } | ... | ... |
-
Please register or sign in to post a comment