From 9119f766d29e6b4a79892e7afed2e828e68d3428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20GALLARD?= Date: Mon, 22 Feb 2016 13:35:54 +0100 Subject: [PATCH] Fix cookies in accordance with the "net / http" and Flash usage Fixed issue of Flash cookies that are deleted before being read Max-age parameter conform to "net/http" Cookie --- context/output.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/context/output.go b/context/output.go index 2d756e27..f27bba17 100644 --- a/context/output.go +++ b/context/output.go @@ -97,9 +97,10 @@ func (output *BeegoOutput) Cookie(name string, value string, others ...interface maxAge = v } - if maxAge > 0 { + switch { + case maxAge > 0: fmt.Fprintf(&b, "; Expires=%s; Max-Age=%d", time.Now().Add(time.Duration(maxAge)*time.Second).UTC().Format(time.RFC1123), maxAge) - } else { + case maxAge < 0: fmt.Fprintf(&b, "; Max-Age=0") } }