update cookies module to v0.7.0 to gain support for sameSite attribute
This commit is contained in:
Родитель
0a577de729
Коммит
e0c7db1688
|
@ -8,7 +8,7 @@
|
|||
"url" : "https://github.com/mozilla/node-client-sessions"
|
||||
},
|
||||
"dependencies" : {
|
||||
"cookies" : "0.5.0"
|
||||
"cookies" : "^0.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vows": "0.8.1",
|
||||
|
|
|
@ -1240,6 +1240,37 @@ suite.addBatch({
|
|||
}
|
||||
});
|
||||
|
||||
suite.addBatch({
|
||||
"sameSite cookie": {
|
||||
topic: function() {
|
||||
var self = this;
|
||||
var app = express();
|
||||
|
||||
app.use(cookieSessions({
|
||||
cookieName: 'session',
|
||||
secret: 'yo',
|
||||
activeDuration: 0,
|
||||
cookie: {
|
||||
sameSite: 'lax'
|
||||
}
|
||||
}));
|
||||
|
||||
app.get("/foo", function(req, res) {
|
||||
req.session.foo = 'foobar';
|
||||
res.send("hello");
|
||||
});
|
||||
|
||||
var browser = createBrowser(app);
|
||||
browser.get("/foo", function(res, $) {
|
||||
self.callback(null, res);
|
||||
});
|
||||
},
|
||||
"has samesite attribute": function(err, res) {
|
||||
assert.match(res.headers['set-cookie'][0], /samesite=lax/, "cookie uses samesite");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var sixtyFourByteKey = new Buffer(
|
||||
'0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef',
|
||||
'binary'
|
||||
|
|
Загрузка…
Ссылка в новой задаче