req.signedCookies.js
This file
Path
test/req.signedCookies.js
40 lines · 941 bytes · JavaScript
Last changed by
tests: fix error-handling typoSeth Krasnianskibefore adoption8fe5fd8
History of this fileTake it
The walk stopped after 200 commits: lines older than 6bc7574 point at it.
docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574
lines 1–31why, one step back12var express = require('../')3 , request = require('supertest')4 , cookieParser = require('cookie-parser')56describe('req', function(){7 describe('.signedCookies', function(){8 it('should return a signed JSON cookie', function(done){9 var app = express();1011 app.use(cookieParser('secret'));1213 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){tests: fix error-handling typoSeth Krasnianskibefore adoption8fe5fd8
line 32why, one step back32 if (err) return done(err);docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574
lines 33–40why, one step back33 res.body.should.eql({ obj: { foo: 'bar' } });34 done();35 });36 });37 })38 })39})40