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
1 changed files with 3 additions and 1 deletions

View File

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