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

Handle IncomingMessage/ServerResponse object types in debug

Fixes #1202
This commit is contained in:
Nick O'Leary 2017-04-10 21:59:59 +01:00
parent 08d21ccba7
commit 301ac279ff
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -100,6 +100,10 @@ module.exports = function(RED) {
var seenAts = []; var seenAts = [];
try { try {
msg.format = msg.msg.constructor.name || "Object"; 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) { } catch(err) {
msg.format = "Object"; msg.format = "Object";
} }
@ -116,7 +120,7 @@ module.exports = function(RED) {
msg.msg = msg.msg.slice(0,debuglength); 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) { msg.msg = safeJSONStringify(msg.msg, function(key, value) {
if (key === '_req' || key === '_res') { if (key === '_req' || key === '_res') {
return "[internal]" return "[internal]"