Skip to content

Commit bb84cf9

Browse files
LinusUdougwilson
authored andcommitted
tests: add test for signed cookie without secret
closes #2986
1 parent f3d99a4 commit bb84cf9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/res.cookie.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,22 @@ describe('res', function(){
150150
})
151151
})
152152

153+
describe('signed without secret', function(){
154+
it('should throw an error', function(done){
155+
var app = express();
156+
157+
app.use(cookieParser());
158+
159+
app.use(function(req, res){
160+
res.cookie('name', 'tobi', { signed: true }).end();
161+
});
162+
163+
request(app)
164+
.get('/')
165+
.expect(500, /secret\S+ required for signed cookies/, done);
166+
})
167+
})
168+
153169
describe('.signedCookie(name, string)', function(){
154170
it('should set a signed cookie', function(done){
155171
var app = express();

0 commit comments

Comments
 (0)