We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents c4d60fb + bc2c31a commit 18b3e66Copy full SHA for 18b3e66
1 file changed
mongostore.go
@@ -159,6 +159,17 @@ func (m *MongoStore) MaxAge(age int) {
159
}
160
161
162
+// MaxLength restricts the maximum length of new sessions to l.
163
+// If l is 0 there is no limit to the size of a session, use with caution.
164
+// The default for a new Store is 4096.
165
+func (m *MongoStore) MaxLength(l int) {
166
+ for _, c := range m.Codecs {
167
+ if codec, ok := c.(*securecookie.SecureCookie); ok {
168
+ codec.MaxLength(l)
169
+ }
170
171
+}
172
+
173
func (m *MongoStore) load(session *sessions.Session) error {
174
s := Session{}
175
err := m.coll.FindOne(context.TODO(), makeFilterByID(session.ID)).Decode(&s)
0 commit comments