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

Merge branch 'master' into tabs

This commit is contained in:
Nicholas O'Leary 2013-10-23 00:03:47 +01:00
commit ec09dc524a
3 changed files with 51 additions and 48 deletions

View File

@ -22,24 +22,25 @@ try {
var eyes = require("eyes"); var eyes = require("eyes");
gotEyes = true; gotEyes = true;
} catch(e) { } 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) { function Xml2jsNode(n) {
RED.nodes.createNode(this,n); RED.nodes.createNode(this,n);
this.useEyes = n.useEyes; this.useEyes = n.useEyes;
var node = this; var node = this;
this.on("input", function(msg) { this.on("input", function(msg) {
parseString(msg.payload, function (err, result) { parseString(msg.payload, function (err, result) {
if (err) { node.error(err); }
else {
msg.payload = result; msg.payload = result;
node.send(msg); node.send(msg);
if (node.useEyes == true) { if (node.useEyes == true) {
if (gotEyes == true) { eyes.inspect(msg); } if (gotEyes == true) { eyes.inspect(msg); }
else { node.log(JSON.stringify(msg)); } else { node.log(JSON.stringify(msg)); }
} }
}
}); });
}); });
} }
RED.nodes.registerType("xml2js",Xml2jsNode); RED.nodes.registerType("xml2js",Xml2jsNode);

View File

@ -79,7 +79,9 @@ function HTTPRequest(n) {
var httplib = (/^https/.test(url))?https:http; var httplib = (/^https/.test(url))?https:http;
var node = this; var node = this;
this.on("input",function(msg) { this.on("input",function(msg) {
if (msg.url) {
httplib = (/^https/.test(msg.url))?https:http;
}
var opts = urllib.parse(msg.url||url); var opts = urllib.parse(msg.url||url);
opts.method = (msg.method||method).toUpperCase(); opts.method = (msg.method||method).toUpperCase();
if (msg.headers) { if (msg.headers) {