I needed to get the cookies from an express route and check the contents during a test. I couldn't find anything to get the cookies. So I created this package. It doesn't handle every case. It is pretty simple...
Will return: { value: 'This is my data', Path: '/', HttpOnly: true, Secure: true }
returns an object with the cookies. each cookie can be found by name.
Example Returned Data { cookie1: { value: 'This is my data', Path: '/', HttpOnly: true, Secure: true }, cookie2: { value: 'This is my data', Path: '/', HttpOnly: true, Secure: true } }
it('should create a secure cookie', function (done) { request(express_app) .get('/route/to/test') .expect(200) .end(function(err, res) { expect(cookies.find('auth_token', res).Secure).to.equal(true); expect(err).to.not.exist; done(); }); });