Save adds a single session to the response.
(r *http.Request, w http.ResponseWriter, session *Session)
| 105 | |
| 106 | // Save adds a single session to the response. |
| 107 | func (s *CookieStore) Save(r *http.Request, w http.ResponseWriter, |
| 108 | session *Session) error { |
| 109 | encoded, err := securecookie.EncodeMulti(session.Name(), session.Values, |
| 110 | s.Codecs...) |
| 111 | if err != nil { |
| 112 | return err |
| 113 | } |
| 114 | http.SetCookie(w, NewCookie(session.Name(), encoded, session.Options)) |
| 115 | return nil |
| 116 | } |
| 117 | |
| 118 | // MaxAge sets the maximum age for the store and the underlying cookie |
| 119 | // implementation. Individual sessions can be deleted by setting Options.MaxAge |