mirror of
https://github.com/astaxie/beego.git
synced 2024-11-29 11:11:33 +00:00
Fix set cookie bug, zero max age is not valid.
This commit is contained in:
parent
21d1267c14
commit
b0e2012a17
@ -105,7 +105,7 @@ func (output *BeegoOutput) Cookie(name string, value string, others ...interface
|
|||||||
switch {
|
switch {
|
||||||
case maxAge > 0:
|
case maxAge > 0:
|
||||||
fmt.Fprintf(&b, "; Expires=%s; Max-Age=%d", time.Now().Add(time.Duration(maxAge)*time.Second).UTC().Format(time.RFC1123), maxAge)
|
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")
|
fmt.Fprintf(&b, "; Max-Age=0")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user