1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 23:30:50 +00:00

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
This commit is contained in:
Mickaël GALLARD 2016-02-22 13:35:54 +01:00
parent 2b23764ee0
commit 9119f766d2

View File

@ -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")
}
}