diff options
-rw-r--r-- | platform/node/index.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/platform/node/index.js b/platform/node/index.js index 54ba5c0dc6..5902f0bf59 100644 --- a/platform/node/index.js +++ b/platform/node/index.js @@ -19,7 +19,12 @@ var Map = function(options) { return new constructor(Object.assign(options, { request: function(req) { request(req, function() { - req.respond.apply(req, arguments); + var args = arguments; + // Protect ourselves from `request` implementations that try to release Zalgo. + // http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony + setImmediate(function() { + req.respond.apply(req, args); + }); }); } })); |