makeStateCookie creates a new state cookie with the specified value and Max-Age. Max-Age has precedence whilst determining the state cookie expiration even though both Expires and Max-Age are set.
(value string, maxAge int)
| 332 | // Max-Age has precedence whilst determining the state cookie expiration even though |
| 333 | // both Expires and Max-Age are set. |
| 334 | func (h *handler) makeStateCookie(value string, maxAge int) *http.Cookie { |
| 335 | cookie := &http.Cookie{ |
| 336 | Name: stateCookieName, |
| 337 | Value: value, |
| 338 | HttpOnly: true, |
| 339 | MaxAge: maxAge, |
| 340 | } |
| 341 | if h.rq.TLS != nil { |
| 342 | cookie.Secure = true |
| 343 | } |
| 344 | if maxAge > 0 { |
| 345 | cookie.Expires = time.Now().Add(time.Duration(maxAge) * time.Second) |
| 346 | } |
| 347 | base.AddDbPathToCookie(h.rq, cookie) |
| 348 | return cookie |
| 349 | } |
no test coverage detected