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

Method Flashes

sessions.go:47–59  ·  view source on GitHub ↗

Flashes returns a slice of flash messages from the session. A single variadic argument is accepted, and it is optional: it defines the flash key. If not defined "_flash" is used by default.

(vars ...string)

Source from the content-addressed store, hash-verified

45// A single variadic argument is accepted, and it is optional: it defines
46// the flash key. If not defined "_flash" is used by default.
47func (s *Session) Flashes(vars ...string) []interface{} {
48 var flashes []interface{}
49 key := flashesKey
50 if len(vars) > 0 {
51 key = vars[0]
52 }
53 if v, ok := s.Values[key]; ok {
54 // Drop the flashes and return it.
55 delete(s.Values, key)
56 flashes = v.([]interface{})
57 }
58 return flashes
59}
60
61// AddFlash adds a flash message to the session.
62//

Callers 1

TestFlashesFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestFlashesFunction · 0.76