MCPcopy
hub / github.com/gorilla/sessions / New

Method New

store.go:191–207  ·  view source on GitHub ↗

New returns a session for the given name without adding it to the registry. See CookieStore.New().

(r *http.Request, name string)

Source from the content-addressed store, hash-verified

189//
190// See CookieStore.New().
191func (s *FilesystemStore) New(r *http.Request, name string) (*Session, error) {
192 session := NewSession(s, name)
193 opts := *s.Options
194 session.Options = &opts
195 session.IsNew = true
196 var err error
197 if c, errCookie := r.Cookie(name); errCookie == nil {
198 err = securecookie.DecodeMulti(name, c.Value, &session.ID, s.Codecs...)
199 if err == nil {
200 err = s.load(session)
201 if err == nil {
202 session.IsNew = false
203 }
204 }
205 }
206 return session, err
207}
208
209var base32RawStdEncoding = base32.StdEncoding.WithPadding(base32.NoPadding)
210

Callers 4

TestGH8FilesystemStoreFunction · 0.95
TestGH2MaxLengthFunction · 0.95

Calls 2

loadMethod · 0.95
NewSessionFunction · 0.85

Tested by 4

TestGH8FilesystemStoreFunction · 0.76
TestGH2MaxLengthFunction · 0.76