parse_cookie_response

1.0.0 • Public • Published

Parse Cookie Response

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...

find

Will return: { value: 'This is my data', Path: '/', HttpOnly: true, Secure: true }

get_all

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 } }

How to use

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(); }); });

Readme

Keywords

Package Sidebar

Install

npm i parse_cookie_response

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • gruberjl