From 301ac279ff1b18f88dd0cc0e8b2ed1d2f7753b56 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 10 Apr 2017 21:59:59 +0100 Subject: [PATCH] Handle IncomingMessage/ServerResponse object types in debug Fixes #1202 --- nodes/core/core/58-debug.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nodes/core/core/58-debug.js b/nodes/core/core/58-debug.js index 4e8588322..514ce09e0 100644 --- a/nodes/core/core/58-debug.js +++ b/nodes/core/core/58-debug.js @@ -100,6 +100,10 @@ module.exports = function(RED) { var seenAts = []; try { msg.format = msg.msg.constructor.name || "Object"; + // Handle special case of msg.req/res objects from HTTP In node + if (msg.format === "IncomingMessage" || msg.format === "ServerResponse") { + msg.format = "Object"; + } } catch(err) { msg.format = "Object"; } @@ -116,7 +120,7 @@ module.exports = function(RED) { msg.msg = msg.msg.slice(0,debuglength); } } - if (isArray || (msg.format === "Object")) { + if (isArray || msg.format === "Object") { msg.msg = safeJSONStringify(msg.msg, function(key, value) { if (key === '_req' || key === '_res') { return "[internal]"