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

Add JSONP support to http response node

Fixes #102
This commit is contained in:
Nicholas O'Leary 2013-12-08 19:28:52 +00:00
parent fae34f8244
commit f22cd381ee

View File

@ -67,7 +67,11 @@ function HTTPOut(n) {
msg.res.set(msg.headers);
}
var statusCode = msg.statusCode || 200;
if (typeof msg.payload == "object" && !Buffer.isBuffer(msg.payload)) {
msg.res.jsonp(statusCode,msg.payload);
} else {
msg.res.send(statusCode,msg.payload);
}
} else {
node.warn("No response object");
}