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

Add warning if http response node doesn't get a msg.res object

This commit is contained in:
Nicholas O'Leary 2013-10-09 20:45:51 +01:00
parent e907341d69
commit 6298a13f06

View File

@ -57,7 +57,7 @@ RED.nodes.registerType("http in",HTTPIn);
function HTTPOut(n) { function HTTPOut(n) {
RED.nodes.createNode(this,n); RED.nodes.createNode(this,n);
var node = this;
this.on("input",function(msg) { this.on("input",function(msg) {
if (msg.res) { if (msg.res) {
if (msg.headers) { if (msg.headers) {
@ -65,6 +65,8 @@ function HTTPOut(n) {
} }
var statusCode = msg.statusCode || 200; var statusCode = msg.statusCode || 200;
msg.res.send(statusCode,msg.payload); msg.res.send(statusCode,msg.payload);
} else {
node.warn("No response object");
} }
}); });
} }