Allow http request node to pass through existing msg properties rather than wiping clean (in case needed on other side...)

Also one more try / catch to xml parser... could still barf if provoked.
This commit is contained in:
Dave C-J
2013-10-23 21:27:54 +01:00
parent 30f3a46d46
commit f1f00da1a8
2 changed files with 89 additions and 90 deletions

View File

@@ -30,17 +30,20 @@ function Xml2jsNode(n) {
this.useEyes = n.useEyes;
var node = this;
this.on("input", function(msg) {
parseString(msg.payload, function (err, result) {
if (err) { node.error(err); }
else {
msg.payload = result;
node.send(msg);
if (node.useEyes == true) {
if (gotEyes == true) { eyes.inspect(msg); }
else { node.log(JSON.stringify(msg)); }
}
}
});
try {
parseString(msg.payload, function (err, result) {
if (err) { node.error(err); }
else {
msg.payload = result;
node.send(msg);
if (node.useEyes == true) {
if (gotEyes == true) { eyes.inspect(msg); }
else { node.log(JSON.stringify(msg)); }
}
}
});
}
catch(e) { console.log(e); }
});
}
RED.nodes.registerType("xml2js",Xml2jsNode);