req.signedCookies.js
This file
Path
test/req.signedCookies.js
40 lines · 940 bytes · JavaScript
Last changed by
remove unnecessary test/support/httpJonathan Ongbefore adoption643397e
History of this fileTake it
The walk stopped after 200 commits: lines older than 2e68ddb point at it.
expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 1–2why, one step back12var express = require('../')remove unnecessary test/support/httpJonathan Ongbefore adoption643397e
line 3why, one step back3 , request = require('supertest')remove last pieces of connect dependencyRoman Shtylmanbefore adoption1396e08
line 4why, one step back4 , cookieParser = require('cookie-parser')expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 5–10why, one step back56describe('req', function(){7 describe('.signedCookies', function(){8 it('should return a signed JSON cookie', function(done){9 var app = express();10remove last pieces of connect dependencyRoman Shtylmanbefore adoption1396e08
line 11why, one step back11 app.use(cookieParser('secret'));expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 12–40why, one step back1213 app.use(function(req, res){14 if ('/set' == req.path) {15 res.cookie('obj', { foo: 'bar' }, { signed: true });16 res.end();17 } else {18 res.send(req.signedCookies);19 }20 });2122 request(app)23 .get('/set')24 .end(function(err, res){25 if (err) return done(err);26 var cookie = res.header['set-cookie'];2728 request(app)29 .get('/')30 .set('Cookie', cookie)31 .end(function(err, res){32 if (err) return don(err);33 res.body.should.eql({ obj: { foo: 'bar' } });34 done();35 });36 });37 })38 })39})40