From a2d72f0aa3d55498657a529221fc349025469ef4 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 2 May 2017 15:21:59 +0200 Subject: [PATCH] Fixes #2 - Coalesce cookies into one header. --- cometd-nodejs-client.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cometd-nodejs-client.js b/cometd-nodejs-client.js index 6d1b58e..1aa364a 100644 --- a/cometd-nodejs-client.js +++ b/cometd-nodejs-client.js @@ -40,10 +40,17 @@ module.exports = { }; this.send = function(data) { - var self = this; + var cookies = ''; for (var i = 0; i < _cookies.length; ++i) { - _config.headers['Cookie'] = _cookies[i]; + if (i > 0) { + cookies += '; '; + } + cookies += _cookies[i]; } + if (cookies) { + _config.headers['Cookie'] = cookies; + } + var self = this; _request = http.request(_config, function(response) { var success = false; self.status = response.statusCode;