Commit 75ca7b77 authored by astaxie's avatar astaxie Committed by GitHub

Merge pull request #2518 from sicojuy/develop

Fix set cookie bug, zero max age is not valid.
parents 12dff072 b0e2012a
...@@ -105,7 +105,7 @@ func (output *BeegoOutput) Cookie(name string, value string, others ...interface ...@@ -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")
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment