From 60200689f46998c2f382f3887d6a4dea231b70d6 Mon Sep 17 00:00:00 2001 From: astaxie Date: Thu, 11 Jul 2013 10:57:34 +0800 Subject: [PATCH] fix setcookie time type --- context.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/context.go b/context.go index 6331dc0a..ea014764 100644 --- a/context.go +++ b/context.go @@ -72,7 +72,14 @@ func (ctx *Context) SetCookie(name string, value string, others ...interface{}) var b bytes.Buffer fmt.Fprintf(&b, "%s=%s", sanitizeName(name), sanitizeValue(value)) if len(others) > 0 { - fmt.Fprintf(&b, "; Max-Age=%d", others[0].(int64)) + switch others[0].(type) { + case int: + fmt.Fprintf(&b, "; Max-Age=%d", others[0].(int)) + case int64: + fmt.Fprintf(&b, "; Max-Age=%d", others[0].(int64)) + case int32: + fmt.Fprintf(&b, "; Max-Age=%d", others[0].(int32)) + } } else { fmt.Fprintf(&b, "; Max-Age=0") }