From 72476cc8a7dd058e93022dbe20aa11e22cf4634d Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sat, 7 Jun 2014 23:18:25 +0100 Subject: [PATCH] Set content-length in HTTP response node Fixes #233 --- nodes/core/io/21-httpin.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nodes/core/io/21-httpin.js b/nodes/core/io/21-httpin.js index 3ae5cfc3b..6e932357d 100644 --- a/nodes/core/io/21-httpin.js +++ b/nodes/core/io/21-httpin.js @@ -123,6 +123,9 @@ module.exports = function(RED) { if (typeof msg.payload == "object" && !Buffer.isBuffer(msg.payload)) { msg.res.jsonp(statusCode,msg.payload); } else { + if (msg.res.get('content-length') == null) { + msg.res.set('content-length', Buffer.byteLength(msg.payload)); + } msg.res.send(statusCode,msg.payload); } } else {