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

Method AddFlash

sessions.go:65–75  ·  view source on GitHub ↗

AddFlash adds a flash message to 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.

(value interface{}, vars ...string)

Source from the content-addressed store, hash-verified

63// A single variadic argument is accepted, and it is optional: it defines
64// the flash key. If not defined "_flash" is used by default.
65func (s *Session) AddFlash(value interface{}, vars ...string) {
66 key := flashesKey
67 if len(vars) > 0 {
68 key = vars[0]
69 }
70 var flashes []interface{}
71 if v, ok := s.Values[key]; ok {
72 flashes = v.([]interface{})
73 }
74 s.Values[key] = append(flashes, value)
75}
76
77// Save is a convenience method to save this session. It is the same as calling
78// store.Save(request, response, session). You should call Save before writing to

Callers 1

TestFlashesFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestFlashesFunction · 0.76