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

Avoid stringify ServerResponse and Socket in Debug node

Fixes #1311
This commit is contained in:
Nick O'Leary 2017-07-03 20:53:20 +01:00
parent c34c98386e
commit b8c80a2310
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -141,12 +141,18 @@ module.exports = function(RED) {
if (value.length > debuglength) {
value = value.substring(0,debuglength)+"...";
}
} else if (value !== null && typeof value === 'object' && value.type === "Buffer") {
} else if (value && value.constructor) {
if (value.constructor.name === "Buffer") {
value.__encoded__ = true;
value.length = value.data.length;
if (value.length > debuglength) {
value.data = value.data.slice(0,debuglength);
}
} else if (value.constructor.name === "ServerResponse") {
value = "[internal]"
} else if (value.constructor.name === "Socket") {
value = "[internal]"
}
}
return value;
}," ");