Skip to content
Browse files

remove space after semicolon when joining cookies

  • Loading branch information...
1 parent 7d3c52f commit 20e24d31a42dd111487f4438215946c481a3306c @caolan committed Jul 31, 2010
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/cookie-sessions.js
  2. +2 −2 test/test-cookie-sessions.js
View
2 lib/cookie-sessions.js
@@ -29,7 +29,7 @@ var exports = module.exports = function(settings){
// does not expire unless the user is inactive.
headers['Set-Cookie'] = escape(s.session_key) + '=' +
escape(exports.serialize(s.secret, req.session)) +
- (headers['Set-Cookie'] ? '; ' + headers['Set-Cookie']: '');
+ (headers['Set-Cookie'] ? ';' + headers['Set-Cookie']: '');
// call the original writeHead on the request
return _writeHead.apply(res, args);
View
4 test/test-cookie-sessions.js
@@ -391,10 +391,10 @@ exports['set multiple cookies'] = function(test){
var req = {headers: {cookie:''}};
var res = {writeHead: function(statusCode, headers){
test.equals(
- headers['Set-Cookie'].split(/\s*;\s*/g)[1],
+ headers['Set-Cookie'].split(';')[1],
'testcookie=testvalue'
);
- test.equals(headers['Set-Cookie'].split(/\s*;\s*/g).length, 2);
+ test.equals(headers['Set-Cookie'].split(';').length, 2);
test.done();
}};
sessions({secret: 'secret'})(req, res, function(){

0 comments on commit 20e24d3

Please sign in to comment.
Something went wrong with that request. Please try again.