mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Make the encode option a boolean value to determine whether to encode
This commit is contained in:
@@ -161,9 +161,13 @@ 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') {
|
||||
// If the encode option is specified, pass it.
|
||||
var options = msg.cookies[name].encode ? {encode: msg.cookies[name].encode} : undefined;
|
||||
opts.jar.setCookie(cookie.serialize(name, msg.cookies[name].value, options), url);
|
||||
if(msg.cookies[name].encode === false){
|
||||
// If the encode option is false, the value is not encoded.
|
||||
opts.jar.setCookie(cookie.serialize(name, msg.cookies[name].value, {encode: String}), url);
|
||||
} else {
|
||||
// The value is encoded by encodeURIComponent().
|
||||
opts.jar.setCookie(cookie.serialize(name, msg.cookies[name].value), url);
|
||||
}
|
||||
} else {
|
||||
opts.jar.setCookie(cookie.serialize(name, msg.cookies[name]), url);
|
||||
}
|
||||
|
Reference in New Issue
Block a user