1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Revert cookie encoding behavior

This commit is contained in:
Hiroki Uchikawa 2019-01-30 19:24:19 +09:00
parent 888e7ee023
commit 2037741b54

View File

@ -148,16 +148,9 @@ module.exports = function(RED) {
};
}
if (opts.headers.hasOwnProperty('cookie')) {
var cookies = cookie.parse(opts.headers.cookie);
var cookies = cookie.parse(opts.headers.cookie, {decode:String});
for (var name in cookies) {
if (cookies.hasOwnProperty(name)) {
if (cookies[name] === null) {
// This case clears a cookie for HTTP In/Response nodes.
// Ignore for this node.
} else {
opts.jar.setCookie(name + '=' + cookies[name], url);
}
}
opts.jar.setCookie(cookie.serialize(name, cookies[name], {encode:String}), url);
}
delete opts.headers.cookie;
}
@ -168,9 +161,9 @@ module.exports = function(RED) {
// This case clears a cookie for HTTP In/Response nodes.
// Ignore for this node.
} else if (typeof msg.cookies[name] === 'object') {
opts.jar.setCookie(name + '=' + msg.cookies[name].value, url);
opts.jar.setCookie(cookie.serialize(name, msg.cookies[name].value), url);
} else {
opts.jar.setCookie(name + '=' + msg.cookies[name], url);
opts.jar.setCookie(cookie.serialize(name, msg.cookies[name]), url);
}
}
}