Support streamed response from HttpNodeInstance

This commit is contained in:
SteveSandersonMS
2016-06-07 16:49:40 +01:00
parent 3440aa4344
commit 967edd2b2a
4 changed files with 52 additions and 20 deletions

View File

@@ -42,6 +42,19 @@ var server = http.createServer(function(req, res) {
}
};
// Support streamed responses
Object.defineProperty(callback, 'stream', {
enumerable: true,
get: function() {
if (!hasSentResult) {
hasSentResult = true;
res.setHeader('Content-Type', 'application/octet-stream');
}
return res;
}
});
try {
func.apply(null, [callback].concat(bodyJson.args));
} catch (synchronousException) {