From b8c80a2310c42705825f162e8061a5abb2cb6870 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 3 Jul 2017 20:53:20 +0100 Subject: [PATCH] Avoid stringify ServerResponse and Socket in Debug node Fixes #1311 --- nodes/core/core/58-debug.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/nodes/core/core/58-debug.js b/nodes/core/core/58-debug.js index 1cb313ad5..e34cc0c9a 100644 --- a/nodes/core/core/58-debug.js +++ b/nodes/core/core/58-debug.js @@ -141,11 +141,17 @@ module.exports = function(RED) { if (value.length > debuglength) { value = value.substring(0,debuglength)+"..."; } - } else if (value !== null && typeof value === 'object' && value.type === "Buffer") { - value.__encoded__ = true; - value.length = value.data.length; - if (value.length > debuglength) { - value.data = value.data.slice(0,debuglength); + } 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;