beedoc icon indicating copy to clipboard operation
beedoc copied to clipboard

Session Module Docs Needs updating

Open moar55 opened this issue 8 years ago • 1 comments

Hi, The latest version of beego session module requires usage of session.ManagerConfig instance as second parameter to session.NewManager when initalizing a session. This isn't shown in the docs, what is shown is this : globalSessions, _ = session.NewManager("memory", {"cookieName":"gosessionid", "enableSetCookie,omitempty": true, "gclifetime":3600, "maxLifetime": 3600, "secure": false, "sessionIDHashFunc": "sha1", "sessionIDHashKey": "", "cookieLifeTime": 3600, "providerConfig": ""}) Moreover, the params in the string in this example are different now since the session module uses session.NewManager instead.

moar55 avatar Oct 21 '17 15:10 moar55

I have to say I fell into the pitfall here.

What I did is pass the string to json.Unmarshall, but it seems like json library can not handle "enableSetCookie,omitempty" correctly, the value becomes a false and my application will never set a cookie.

我在startsession源码上打断点才发现这个问题,太坑了。

ufolyah avatar Apr 03 '20 04:04 ufolyah