summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Silverlock <matt@eatsleeprepeat.net>2015-08-06 10:39:54 +0300
committerMatt Silverlock <matt@eatsleeprepeat.net>2015-08-06 10:39:54 +0300
commit460e18584b819b2ffc92706c71e9c4791aba65ea (patch)
treebf053ec315d74f6a457451b51e3eb65e7fed52bc
parent286213d1c4d3c5f7ca906279577b126e58fb933c (diff)
Improved docs re: calling Save before writing/returning.
-rw-r--r--README.md2
-rw-r--r--doc.go2
-rw-r--r--sessions.go3
3 files changed, 4 insertions, 3 deletions
diff --git a/README.md b/README.md
index 34a8c11..9f2a2ac 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ Let's start with an example that shows the sessions API in a nutshell:
// Set some session values.
session.Values["foo"] = "bar"
session.Values[42] = 43
- // Save it.
+ // Save it before we write to the response/return from the handler.
session.Save(r, w)
}
```
diff --git a/doc.go b/doc.go
index 7f8be22..7c09f8b 100644
--- a/doc.go
+++ b/doc.go
@@ -35,7 +35,7 @@ Let's start with an example that shows the sessions API in a nutshell:
// Set some session values.
session.Values["foo"] = "bar"
session.Values[42] = 43
- // Save it.
+ // Save it before we write to the response/return from the handler.
session.Save(r, w)
}
diff --git a/sessions.go b/sessions.go
index 53111b3..d6bfb6e 100644
--- a/sessions.go
+++ b/sessions.go
@@ -88,7 +88,8 @@ func (s *Session) AddFlash(value interface{}, vars ...string) {
}
// Save is a convenience method to save this session. It is the same as calling
-// store.Save(request, response, session)
+// store.Save(request, response, session). You should call Save before writing to
+// the response or returning from the handler.
func (s *Session) Save(r *http.Request, w http.ResponseWriter) error {
return s.store.Save(r, w, s)
}