From f22cd381ee8bead1bd7bc69df3ac6eac320a4529 Mon Sep 17 00:00:00 2001 From: Nicholas O'Leary Date: Sun, 8 Dec 2013 19:28:52 +0000 Subject: [PATCH] Add JSONP support to http response node Fixes #102 --- nodes/core/io/21-httpin.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nodes/core/io/21-httpin.js b/nodes/core/io/21-httpin.js index ba00b67e8..4f5305a43 100644 --- a/nodes/core/io/21-httpin.js +++ b/nodes/core/io/21-httpin.js @@ -67,7 +67,11 @@ function HTTPOut(n) { msg.res.set(msg.headers); } var statusCode = msg.statusCode || 200; - msg.res.send(statusCode,msg.payload); + 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"); }