1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-26 23:40:49 +00:00

Merge pull request #2518 from sicojuy/develop

Fix set cookie bug, zero max age is not valid.
This commit is contained in:
astaxie 2017-03-21 09:44:37 +08:00 committed by GitHub
commit 75ca7b77b6

View File

@ -105,7 +105,7 @@ func (output *BeegoOutput) Cookie(name string, value string, others ...interface
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)
case maxAge < 0:
case maxAge <= 0:
fmt.Fprintf(&b, "; Max-Age=0")
}
}