Skip to content

Commit 37a74f4

Browse files
committed
Add a Clear function to Session closes gobuffalo#230
1 parent bf8f0f4 commit 37a74f4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

session.go

+7
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ func (s *Session) Delete(name interface{}) {
3535
delete(s.Session.Values, name)
3636
}
3737

38+
// Clear the current session
39+
func (s *Session) Clear() {
40+
for k, _ := range s.Session.Values {
41+
delete(s.Session.Values, k)
42+
}
43+
}
44+
3845
// Get a session using a request and response.
3946
func (a *App) getSession(r *http.Request, w http.ResponseWriter) *Session {
4047
session, _ := a.SessionStore.Get(r, a.SessionName)

0 commit comments

Comments
 (0)