make sure to bind target methods to the target itself in the proxy, add test for session.clear()
This commit is contained in:
Родитель
ccf9b93d02
Коммит
20101dc557
|
@ -37,8 +37,8 @@ Session.prototype = {
|
|||
|
||||
// all values from content except special values
|
||||
sessionHandler.get = function(rcvr, name) {
|
||||
if (['clear', 'setExpires'].indexOf(name) > -1)
|
||||
return this.target[name];
|
||||
if (['clear', 'setExpires', 'updateCookie'].indexOf(name) > -1)
|
||||
return this.target[name].bind(this.target);
|
||||
else
|
||||
return this.target.content[name];
|
||||
};
|
||||
|
|
|
@ -43,6 +43,11 @@ suite.addBatch({
|
|||
"session object stores and retrieves values properly": function(err, req) {
|
||||
req.session.foo = 'bar';
|
||||
assert.equal(req.session.foo, 'bar');
|
||||
},
|
||||
"set variables and clear them yields no variables": function(err, req) {
|
||||
req.session.bar = 'baz';
|
||||
req.session.clear();
|
||||
assert.isUndefined(req.session.bar);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче