pax_global_header00006660000000000000000000000064134306623420014515gustar00rootroot0000000000000052 comment=1dc306b0ebe86ab98521811cc090740b4bef48e7 cookie-parser-1.4.4/000077500000000000000000000000001343066234200142665ustar00rootroot00000000000000cookie-parser-1.4.4/.eslintignore000066400000000000000000000000261343066234200167670ustar00rootroot00000000000000coverage node_modules cookie-parser-1.4.4/.eslintrc.yml000066400000000000000000000000351343066234200167100ustar00rootroot00000000000000root: true extends: standard cookie-parser-1.4.4/.gitignore000066400000000000000000000000501343066234200162510ustar00rootroot00000000000000coverage node_modules package-lock.json cookie-parser-1.4.4/.travis.yml000066400000000000000000000050031343066234200163750ustar00rootroot00000000000000language: node_js node_js: - "0.8" - "0.10" - "0.12" - "1.8" - "2.5" - "3.3" - "4.9" - "5.12" - "6.16" - "7.10" - "8.15" - "9.11" - "10.15" - "11.9" sudo: false cache: directories: - node_modules before_install: # Configure npm - | # Skip updating shrinkwrap / lock npm config set shrinkwrap false # Setup Node.js version-specific dependencies - | # eslint for linting # - remove on Node.js < 6 if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 6 ]]; then node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \ grep -E '^eslint(-|$)' | \ xargs npm rm --save-dev fi - | # istanbul for coverage # - remove on Node.js < 0.10 if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -eq 0 && "$(cut -d. -f2 <<< "$TRAVIS_NODE_VERSION")" -lt 10 ]]; then npm rm --save-dev istanbul fi - | # mocha for testing # - use 1.x for Node.js < 0.8 # - use 2.x for Node.js < 0.10 # - use 3.x for Node.js < 6 if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -eq 0 && "$(cut -d. -f2 <<< "$TRAVIS_NODE_VERSION")" -lt 8 ]]; then npm install --save-dev mocha@1.21.5 elif [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -eq 0 && "$(cut -d. -f2 <<< "$TRAVIS_NODE_VERSION")" -lt 10 ]]; then npm install --save-dev mocha@2.5.3 elif [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 6 ]]; then npm install --save-dev mocha@3.5.3 fi - | # supertest for http calls # - use 1.1.0 for Node.js < 0.10 # - use 2.0.0 for Node.js < 4 if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -eq 0 && "$(cut -d. -f2 <<< "$TRAVIS_NODE_VERSION")" -lt 10 ]]; then npm install --silent --save-dev supertest@1.1.0 elif [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 4 ]]; then npm install --silent --save-dev supertest@2.0.0 fi # Update Node.js modules - | # Prune & rebuild node_modules if [[ -d node_modules ]]; then npm prune npm rebuild fi script: - | # Run test script, depending on istanbul install if npm -ps ls istanbul | grep -q istanbul; then npm run-script test-travis else npm test fi - | # Run linting, depending on eslint install if npm -ps ls eslint | grep -q eslint; then npm run-script lint fi after_script: - | # Upload coverage to coveralls, if exists if [[ -f ./coverage/lcov.info ]]; then npm install --save-dev coveralls@2 coveralls < ./coverage/lcov.info fi cookie-parser-1.4.4/HISTORY.md000066400000000000000000000033151343066234200157530ustar00rootroot000000000000001.4.4 / 2019-02-12 ================== * perf: normalize `secret` argument only once 1.4.3 / 2016-05-26 ================== * deps: cookie@0.3.1 - perf: use for loop in parse 1.4.2 / 2016-05-20 ================== * deps: cookie@0.2.4 - perf: enable strict mode - perf: use for loop in parse - perf: use string concatination for serialization 1.4.1 / 2016-01-11 ================== * deps: cookie@0.2.3 * perf: enable strict mode 1.4.0 / 2015-09-18 ================== * Accept array of secrets in addition to a single secret * Fix `JSONCookie` to return `undefined` for non-string arguments * Fix `signedCookie` to return `undefined` for non-string arguments * deps: cookie@0.2.2 1.3.5 / 2015-05-19 ================== * deps: cookie@0.1.3 - Slight optimizations 1.3.4 / 2015-02-15 ================== * deps: cookie-signature@1.0.6 1.3.3 / 2014-09-05 ================== * deps: cookie-signature@1.0.5 1.3.2 / 2014-06-26 ================== * deps: cookie-signature@1.0.4 - fix for timing attacks 1.3.1 / 2014-06-17 ================== * actually export `signedCookie` 1.3.0 / 2014-06-17 ================== * add `signedCookie` export for single cookie unsigning 1.2.0 / 2014-06-17 ================== * export parsing functions * `req.cookies` and `req.signedCookies` are now plain objects * slightly faster parsing of many cookies 1.1.0 / 2014-05-12 ================== * Support for NodeJS version 0.8 * deps: cookie@0.1.2 - Fix for maxAge == 0 - made compat with expires field - tweak maxAge NaN error message 1.0.1 / 2014-02-20 ================== * add missing dependencies 1.0.0 / 2014-02-15 ================== * Genesis from `connect` cookie-parser-1.4.4/LICENSE000066400000000000000000000022211343066234200152700ustar00rootroot00000000000000(The MIT License) Copyright (c) 2014 TJ Holowaychuk Copyright (c) 2015 Douglas Christopher Wilson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. cookie-parser-1.4.4/README.md000066400000000000000000000067661343066234200155640ustar00rootroot00000000000000# cookie-parser [![NPM Version][npm-version-image]][npm-url] [![NPM Downloads][npm-downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Test Coverage][coveralls-image]][coveralls-url] Parse `Cookie` header and populate `req.cookies` with an object keyed by the cookie names. Optionally you may enable signed cookie support by passing a `secret` string, which assigns `req.secret` so it may be used by other middleware. ## Installation ```sh $ npm install cookie-parser ``` ## API ```js var express = require('express') var cookieParser = require('cookie-parser') var app = express() app.use(cookieParser()) ``` ### cookieParser(secret, options) - `secret` a string or array used for signing cookies. This is optional and if not specified, will not parse signed cookies. If a string is provided, this is used as the secret. If an array is provided, an attempt will be made to unsign the cookie with each secret in order. - `options` an object that is passed to `cookie.parse` as the second option. See [cookie](https://www.npmjs.org/package/cookie) for more information. - `decode` a function to decode the value of the cookie ### cookieParser.JSONCookie(str) Parse a cookie value as a JSON cookie. This will return the parsed JSON value if it was a JSON cookie, otherwise it will return the passed value. ### cookieParser.JSONCookies(cookies) Given an object, this will iterate over the keys and call `JSONCookie` on each value, replacing the original value with the parsed value. This returns the same object that was passed in. ### cookieParser.signedCookie(str, secret) Parse a cookie value as a signed cookie. This will return the parsed unsigned value if it was a signed cookie and the signature was valid. If the value was not signed, the original value is returned. If the value was signed but the signature could not be validated, `false` is returned. The `secret` argument can be an array or string. If a string is provided, this is used as the secret. If an array is provided, an attempt will be made to unsign the cookie with each secret in order. ### cookieParser.signedCookies(cookies, secret) Given an object, this will iterate over the keys and check if any value is a signed cookie. If it is a signed cookie and the signature is valid, the key will be deleted from the object and added to the new object that is returned. The `secret` argument can be an array or string. If a string is provided, this is used as the secret. If an array is provided, an attempt will be made to unsign the cookie with each secret in order. ## Example ```js var express = require('express') var cookieParser = require('cookie-parser') var app = express() app.use(cookieParser()) app.get('/', function (req, res) { // Cookies that have not been signed console.log('Cookies: ', req.cookies) // Cookies that have been signed console.log('Signed Cookies: ', req.signedCookies) }) app.listen(8080) // curl command that sends an HTTP request with two cookies // curl http://127.0.0.1:8080 --cookie "Cho=Kim;Greet=Hello" ``` ### [MIT Licensed](LICENSE) [coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/cookie-parser/master [coveralls-url]: https://coveralls.io/r/expressjs/cookie-parser?branch=master [npm-downloads-image]: https://badgen.net/npm/dm/cookie-parser [npm-url]: https://npmjs.org/package/cookie-parser [npm-version-image]: https://badgen.net/npm/v/cookie-parser [travis-image]: https://badgen.net/travis/expressjs/cookie-parser/master [travis-url]: https://travis-ci.org/expressjs/cookie-parser cookie-parser-1.4.4/index.js000066400000000000000000000065051343066234200157410ustar00rootroot00000000000000/*! * cookie-parser * Copyright(c) 2014 TJ Holowaychuk * Copyright(c) 2015 Douglas Christopher Wilson * MIT Licensed */ 'use strict' /** * Module dependencies. * @private */ var cookie = require('cookie') var signature = require('cookie-signature') /** * Module exports. * @public */ module.exports = cookieParser module.exports.JSONCookie = JSONCookie module.exports.JSONCookies = JSONCookies module.exports.signedCookie = signedCookie module.exports.signedCookies = signedCookies /** * Parse Cookie header and populate `req.cookies` * with an object keyed by the cookie names. * * @param {string|array} [secret] A string (or array of strings) representing cookie signing secret(s). * @param {Object} [options] * @return {Function} * @public */ function cookieParser (secret, options) { var secrets = !secret || Array.isArray(secret) ? (secret || []) : [secret] return function cookieParser (req, res, next) { if (req.cookies) { return next() } var cookies = req.headers.cookie req.secret = secrets[0] req.cookies = Object.create(null) req.signedCookies = Object.create(null) // no cookies if (!cookies) { return next() } req.cookies = cookie.parse(cookies, options) // parse signed cookies if (secrets.length !== 0) { req.signedCookies = signedCookies(req.cookies, secrets) req.signedCookies = JSONCookies(req.signedCookies) } // parse JSON cookies req.cookies = JSONCookies(req.cookies) next() } } /** * Parse JSON cookie string. * * @param {String} str * @return {Object} Parsed object or undefined if not json cookie * @public */ function JSONCookie (str) { if (typeof str !== 'string' || str.substr(0, 2) !== 'j:') { return undefined } try { return JSON.parse(str.slice(2)) } catch (err) { return undefined } } /** * Parse JSON cookies. * * @param {Object} obj * @return {Object} * @public */ function JSONCookies (obj) { var cookies = Object.keys(obj) var key var val for (var i = 0; i < cookies.length; i++) { key = cookies[i] val = JSONCookie(obj[key]) if (val) { obj[key] = val } } return obj } /** * Parse a signed cookie string, return the decoded value. * * @param {String} str signed cookie string * @param {string|array} secret * @return {String} decoded value * @public */ function signedCookie (str, secret) { if (typeof str !== 'string') { return undefined } if (str.substr(0, 2) !== 's:') { return str } var secrets = !secret || Array.isArray(secret) ? (secret || []) : [secret] for (var i = 0; i < secrets.length; i++) { var val = signature.unsign(str.slice(2), secrets[i]) if (val !== false) { return val } } return false } /** * Parse signed cookies, returning an object containing the decoded key/value * pairs, while removing the signed key from obj. * * @param {Object} obj * @param {string|array} secret * @return {Object} * @public */ function signedCookies (obj, secret) { var cookies = Object.keys(obj) var dec var key var ret = Object.create(null) var val for (var i = 0; i < cookies.length; i++) { key = cookies[i] val = obj[key] dec = signedCookie(val, secret) if (val !== dec) { ret[key] = dec delete obj[key] } } return ret } cookie-parser-1.4.4/package.json000066400000000000000000000024331343066234200165560ustar00rootroot00000000000000{ "name": "cookie-parser", "description": "Parse HTTP request cookies", "version": "1.4.4", "author": "TJ Holowaychuk (http://tjholowaychuk.com)", "contributors": [ "Douglas Christopher Wilson " ], "license": "MIT", "repository": "expressjs/cookie-parser", "keywords": [ "cookie", "middleware" ], "dependencies": { "cookie": "0.3.1", "cookie-signature": "1.0.6" }, "devDependencies": { "deep-equal": "1.0.1", "eslint": "5.13.0", "eslint-config-standard": "12.0.0", "eslint-plugin-import": "2.16.0", "eslint-plugin-markdown": "1.0.0", "eslint-plugin-node": "7.0.1", "eslint-plugin-promise": "4.0.1", "eslint-plugin-standard": "4.0.0", "istanbul": "0.4.5", "mocha": "5.2.0", "supertest": "3.4.2" }, "files": [ "LICENSE", "HISTORY.md", "index.js" ], "engines": { "node": ">= 0.8.0" }, "scripts": { "lint": "eslint --plugin markdown --ext js,md .", "test": "mocha --reporter spec --bail --check-leaks test/", "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" } } cookie-parser-1.4.4/test/000077500000000000000000000000001343066234200152455ustar00rootroot00000000000000cookie-parser-1.4.4/test/.eslintrc.yml000066400000000000000000000000231343066234200176640ustar00rootroot00000000000000env: mocha: true cookie-parser-1.4.4/test/cookieParser.js000066400000000000000000000232341343066234200202350ustar00rootroot00000000000000 var assert = require('assert') var cookieParser = require('..') var deepEqual = require('deep-equal') var http = require('http') var request = require('supertest') var signature = require('cookie-signature') describe('cookieParser()', function () { var server before(function () { server = createServer('keyboard cat') }) after(function (done) { server.close(done) }) it('should export JSONCookies function', function () { assert(typeof cookieParser.JSONCookies, 'function') }) describe('when no cookies are sent', function () { it('should default req.cookies to {}', function (done) { request(server) .get('/') .expect(200, '{}', done) }) it('should default req.signedCookies to {}', function (done) { request(server) .get('/signed') .expect(200, '{}', done) }) }) describe('when cookies are sent', function () { it('should populate req.cookies', function (done) { request(server) .get('/') .set('Cookie', 'foo=bar; bar=baz') .expect(200, '{"foo":"bar","bar":"baz"}', done) }) it('should inflate JSON cookies', function (done) { request(server) .get('/') .set('Cookie', 'foo=j:{"foo":"bar"}') .expect(200, '{"foo":{"foo":"bar"}}', done) }) it('should not inflate invalid JSON cookies', function (done) { request(server) .get('/') .set('Cookie', 'foo=j:{"foo":') .expect(200, '{"foo":"j:{\\"foo\\":"}', done) }) }) describe('when req.cookies exists', function () { it('should do nothing', function (done) { var _parser = cookieParser() var server = http.createServer(function (req, res) { req.cookies = { fizz: 'buzz' } _parser(req, res, function (err) { if (err) { res.statusCode = 500 res.end(err.message) return } res.end(JSON.stringify(req.cookies)) }) }) request(server) .get('/') .set('Cookie', 'foo=bar; bar=baz') .expect(200, '{"fizz":"buzz"}', done) }) }) describe('when a secret is given', function () { var val = signature.sign('foobarbaz', 'keyboard cat') // TODO: "bar" fails... it('should populate req.signedCookies', function (done) { request(server) .get('/signed') .set('Cookie', 'foo=s:' + val) .expect(200, '{"foo":"foobarbaz"}', done) }) it('should remove the signed value from req.cookies', function (done) { request(server) .get('/') .set('Cookie', 'foo=s:' + val) .expect(200, '{}', done) }) it('should omit invalid signatures', function (done) { server.listen() request(server) .get('/signed') .set('Cookie', 'foo=' + val + '3') .expect(200, '{}', function (err) { if (err) return done(err) request(server) .get('/') .set('Cookie', 'foo=' + val + '3') .expect(200, '{"foo":"foobarbaz.CP7AWaXDfAKIRfH49dQzKJx7sKzzSoPq7/AcBBRVwlI3"}', done) }) }) }) describe('when multiple secrets are given', function () { it('should populate req.signedCookies', function (done) { request(createServer(['keyboard cat', 'nyan cat'])) .get('/signed') .set('Cookie', 'buzz=s:foobar.N5r0C3M8W+IPpzyAJaIddMWbTGfDSO+bfKlZErJ+MeE; fizz=s:foobar.JTCAgiMWsnuZpN3mrYnEUjXlGxmDi4POCBnWbRxse88') .expect(200, '{"buzz":"foobar","fizz":"foobar"}', done) }) }) describe('when no secret is given', function () { var server before(function () { server = createServer() }) it('should populate req.cookies', function (done) { request(server) .get('/') .set('Cookie', 'foo=bar; bar=baz') .expect(200, '{"foo":"bar","bar":"baz"}', done) }) it('should not populate req.signedCookies', function (done) { var val = signature.sign('foobarbaz', 'keyboard cat') request(server) .get('/signed') .set('Cookie', 'foo=s:' + val) .expect(200, '{}', done) }) }) }) describe('cookieParser.JSONCookie(str)', function () { it('should return undefined for non-string arguments', function () { assert.strictEqual(cookieParser.JSONCookie(), undefined) assert.strictEqual(cookieParser.JSONCookie(undefined), undefined) assert.strictEqual(cookieParser.JSONCookie(null), undefined) assert.strictEqual(cookieParser.JSONCookie(42), undefined) assert.strictEqual(cookieParser.JSONCookie({}), undefined) assert.strictEqual(cookieParser.JSONCookie([]), undefined) assert.strictEqual(cookieParser.JSONCookie(function () {}), undefined) }) it('should return undefined for non-JSON cookie string', function () { assert.strictEqual(cookieParser.JSONCookie(''), undefined) assert.strictEqual(cookieParser.JSONCookie('foo'), undefined) assert.strictEqual(cookieParser.JSONCookie('{}'), undefined) }) it('should return object for JSON cookie string', function () { deepEqual(cookieParser.JSONCookie('j:{"foo":"bar"}'), { foo: 'bar' }) }) it('should return undefined on invalid JSON', function () { assert.strictEqual(cookieParser.JSONCookie('j:{foo:"bar"}'), undefined) }) }) describe('cookieParser.signedCookie(str, secret)', function () { it('should return undefined for non-string arguments', function () { assert.strictEqual(cookieParser.signedCookie(undefined, 'keyboard cat'), undefined) assert.strictEqual(cookieParser.signedCookie(null, 'keyboard cat'), undefined) assert.strictEqual(cookieParser.signedCookie(42, 'keyboard cat'), undefined) assert.strictEqual(cookieParser.signedCookie({}, 'keyboard cat'), undefined) assert.strictEqual(cookieParser.signedCookie([], 'keyboard cat'), undefined) assert.strictEqual(cookieParser.signedCookie(function () {}, 'keyboard cat'), undefined) }) it('should pass through non-signed string', function () { assert.strictEqual(cookieParser.signedCookie('', 'keyboard cat'), '') assert.strictEqual(cookieParser.signedCookie('foo', 'keyboard cat'), 'foo') assert.strictEqual(cookieParser.signedCookie('j:{}', 'keyboard cat'), 'j:{}') }) it('should return false for tampered signed string', function () { assert.strictEqual(cookieParser.signedCookie('s:foobaz.N5r0C3M8W+IPpzyAJaIddMWbTGfDSO+bfKlZErJ+MeE', 'keyboard cat'), false) }) it('should return unsigned value for signed string', function () { assert.strictEqual(cookieParser.signedCookie('s:foobar.N5r0C3M8W+IPpzyAJaIddMWbTGfDSO+bfKlZErJ+MeE', 'keyboard cat'), 'foobar') }) describe('when secret is an array', function () { it('should return false for tampered signed string', function () { assert.strictEqual(cookieParser.signedCookie('s:foobaz.N5r0C3M8W+IPpzyAJaIddMWbTGfDSO+bfKlZErJ+MeE', [ 'keyboard cat', 'nyan cat' ]), false) }) it('should return unsigned value for first secret', function () { assert.strictEqual(cookieParser.signedCookie('s:foobar.N5r0C3M8W+IPpzyAJaIddMWbTGfDSO+bfKlZErJ+MeE', [ 'keyboard cat', 'nyan cat' ]), 'foobar') }) it('should return unsigned value for second secret', function () { assert.strictEqual(cookieParser.signedCookie('s:foobar.JTCAgiMWsnuZpN3mrYnEUjXlGxmDi4POCBnWbRxse88', [ 'keyboard cat', 'nyan cat' ]), 'foobar') }) }) }) describe('cookieParser.signedCookies(obj, secret)', function () { it('should ignore non-signed strings', function () { deepEqual(cookieParser.signedCookies({}, 'keyboard cat'), {}) deepEqual(cookieParser.signedCookies({ foo: 'bar' }, 'keyboard cat'), {}) }) it('should include tampered strings as false', function () { deepEqual(cookieParser.signedCookies({ foo: 's:foobaz.N5r0C3M8W+IPpzyAJaIddMWbTGfDSO+bfKlZErJ+MeE' }, 'keyboard cat'), { foo: false }) }) it('should include unsigned strings', function () { deepEqual(cookieParser.signedCookies({ foo: 's:foobar.N5r0C3M8W+IPpzyAJaIddMWbTGfDSO+bfKlZErJ+MeE' }, 'keyboard cat'), { foo: 'foobar' }) }) it('should remove signed strings from original object', function () { var obj = { foo: 's:foobar.N5r0C3M8W+IPpzyAJaIddMWbTGfDSO+bfKlZErJ+MeE' } deepEqual(cookieParser.signedCookies(obj, 'keyboard cat'), { foo: 'foobar' }) deepEqual(obj, {}) }) it('should remove tampered strings from original object', function () { var obj = { foo: 's:foobaz.N5r0C3M8W+IPpzyAJaIddMWbTGfDSO+bfKlZErJ+MeE' } deepEqual(cookieParser.signedCookies(obj, 'keyboard cat'), { foo: false }) deepEqual(obj, {}) }) it('should leave unsigned string in original object', function () { var obj = { fizz: 'buzz', foo: 's:foobar.N5r0C3M8W+IPpzyAJaIddMWbTGfDSO+bfKlZErJ+MeE' } deepEqual(cookieParser.signedCookies(obj, 'keyboard cat'), { foo: 'foobar' }) deepEqual(obj, { fizz: 'buzz' }) }) describe('when secret is an array', function () { it('should include unsigned strings for all secrets', function () { var obj = { buzz: 's:foobar.N5r0C3M8W+IPpzyAJaIddMWbTGfDSO+bfKlZErJ+MeE', fizz: 's:foobar.JTCAgiMWsnuZpN3mrYnEUjXlGxmDi4POCBnWbRxse88' } deepEqual(cookieParser.signedCookies(obj, [ 'keyboard cat', 'nyan cat' ]), { buzz: 'foobar', fizz: 'foobar' }) }) }) }) function createServer (secret) { var _parser = cookieParser(secret) return http.createServer(function (req, res) { _parser(req, res, function (err) { if (err) { res.statusCode = 500 res.end(err.message) return } var cookies = req.url === '/signed' ? req.signedCookies : req.cookies res.end(JSON.stringify(cookies)) }) }) }