@@ -280,36 +280,26 @@ The default value is `'keep'`.
280
280
- ` 'keep' ` The session in the store will be kept, but modifications made during
281
281
the request are ignored and not saved.
282
282
283
- ##### getcookie
284
283
285
- Allows to specify a custom function to read and parse the cookie.
284
+ ##### getcookie, setcookie
286
285
287
- Warning the function signature is subject to change in the future, this option is unsafe
286
+ Allows to specify custom functions to parse and set cookies.
287
+
288
+ Warnings:
289
+ - cookies must be parsed accordingly to how they are set of course
290
+ - the function signatures are subject to change in the future
288
291
289
292
``` js
290
293
app .use (session ({
291
294
getcookie (req ) { // full signature is (req, name, secrets)
292
295
var cookies = cookie .parse (headers .cookie || headers .authorization || ' ' );
293
296
return signature .unsign (cookies[sessionKey] || ' ' , sessionSecret);
294
297
},
295
- secret: ' keyboard cat'
296
- }))
297
- ```
298
-
299
-
300
- ##### setcookie
301
-
302
- Similarly to getookie, it allows to specify a custom function to set cookie.
303
-
304
- Warning again, the function signature is subject to change in the future,
305
- and should be used carefully like getcookie
306
-
307
- ``` js
308
- app .use (session ({
309
298
setcookie (res , name , val , secret , options ) {
310
299
var signed = signature .sign (val, secret);
311
300
var data = cookie .serialize (name, signed, options);
312
301
res .setHeader (' set-cookie' , data);
302
+ res .setHeader (' Access-Control-Expose-Headers' , ' Authorization' );
313
303
res .setHeader (' authorization' , data);
314
304
},
315
305
secret: ' keyboard cat'
0 commit comments