mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user