pkg/http: Don't set MaxAge if cookie handler is request aware.
The securecookie field can be nil. Expect the caller to set max age on the securecookie returned by the secureCookieFunc. Signed-off-by: Mark Laing <mark.laing@canonical.com>
This commit is contained in:
parent
8e86a8e01e
commit
4c7a5c5700
1 changed files with 4 additions and 0 deletions
|
@ -63,6 +63,10 @@ func WithSameSite(sameSite http.SameSite) CookieHandlerOpt {
|
|||
func WithMaxAge(maxAge int) CookieHandlerOpt {
|
||||
return func(c *CookieHandler) {
|
||||
c.maxAge = maxAge
|
||||
if c.IsRequestAware() {
|
||||
return
|
||||
}
|
||||
|
||||
c.securecookie.MaxAge(maxAge)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue