summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrcadena <robert.cadena@gmail.com>2015-02-11 20:47:56 +0300
committerrcadena <robert.cadena@gmail.com>2015-02-11 20:50:14 +0300
commit2c775edb25fb0f91965caac0120a59ba80858c89 (patch)
tree5ee68147a7b28b28389ca13e0e1ca09bfa7b149b
parent0f44a27391116bbb840afe7ee861d0f0d0302a1b (diff)
Moved and tweaked text.
-rw-r--r--doc.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/doc.go b/doc.go
index c4012af..b56700f 100644
--- a/doc.go
+++ b/doc.go
@@ -48,6 +48,9 @@ And finally we call session.Save() to save the session in the response.
Note that in production code, we should check for errors when calling
session.Save(r, w), and either display an error message or otherwise handle it.
+Save must be called before writing to the response, otherwise the session
+cookie will not be sent to the client.
+
Important Note: If you aren't using gorilla/mux, you need to wrap your handlers
with context.ClearHandler as or else you will leak memory! An easy way to do this
is to wrap the top-level mux when calling http.ListenAndServe:
@@ -56,9 +59,6 @@ is to wrap the top-level mux when calling http.ListenAndServe:
The ClearHandler function is provided by the gorilla/context package.
-Also: Call Save before writing to the response, otherwise the session
-cookie will not be sent to the client.
-
That's all you need to know for the basic usage. Let's take a look at other
options, starting with flash messages.