diff --git a/nodes/analysis/73-parsexml.html b/nodes/analysis/73-parsexml.html index 71b3a21cb..cf51ef2db 100644 --- a/nodes/analysis/73-parsexml.html +++ b/nodes/analysis/73-parsexml.html @@ -15,39 +15,39 @@ --> diff --git a/nodes/analysis/73-parsexml.js b/nodes/analysis/73-parsexml.js index 1cb9f61b7..2d0e5225c 100644 --- a/nodes/analysis/73-parsexml.js +++ b/nodes/analysis/73-parsexml.js @@ -19,27 +19,28 @@ var util = require("util"); var parseString = require('xml2js').parseString; var gotEyes = false; try { - var eyes = require("eyes"); - gotEyes = true; + var eyes = require("eyes"); + gotEyes = true; } catch(e) { - util.log("[73-parsexml.js] Warning: Module 'eyes' not installed"); + util.log("[73-parsexml.js] Note: Module 'eyes' not installed. (not needed, but useful)"); } function Xml2jsNode(n) { - RED.nodes.createNode(this,n); - this.useEyes = n.useEyes; - var node = this; - - this.on("input", function(msg) { - parseString(msg.payload, function (err, result) { - msg.payload = result; - node.send(msg); - if (node.useEyes == true) { - if (gotEyes == true) { eyes.inspect(msg); } - else { node.log(JSON.stringify(msg)); } - } - }); - }); + RED.nodes.createNode(this,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)); } + } + } + }); + }); } - RED.nodes.registerType("xml2js",Xml2jsNode); diff --git a/nodes/io/21-httpin.js b/nodes/io/21-httpin.js index 1bc527fda..109638cf9 100644 --- a/nodes/io/21-httpin.js +++ b/nodes/io/21-httpin.js @@ -79,7 +79,9 @@ function HTTPRequest(n) { var httplib = (/^https/.test(url))?https:http; var node = this; this.on("input",function(msg) { - + if (msg.url) { + httplib = (/^https/.test(msg.url))?https:http; + } var opts = urllib.parse(msg.url||url); opts.method = (msg.method||method).toUpperCase(); if (msg.headers) {