From 32e08aeafd73c618bbe9d90b06a5b2f91683fbb6 Mon Sep 17 00:00:00 2001 From: Alexander Corn Date: Wed, 15 Feb 2017 22:54:11 -0500 Subject: [PATCH] Fixed non-200 responses preventing node from exiting --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 2bd369d..f8da6b9 100644 --- a/index.js +++ b/index.js @@ -117,6 +117,9 @@ OPSkinsAPI.prototype._req = function(httpMethod, iface, method, version, input, err.ray = res.headers['cf-ray']; } + // Discard the stream + res.on('data', devNull); + callback(err); return; } @@ -197,10 +200,12 @@ function userAgent() { return "node/" + process.versions.node + " node-opskins/" + require('./package.json').version; } +function devNull() { } + require('./interfaces/IInventory.js'); require('./interfaces/IPricing.js'); require('./interfaces/ISales.js'); require('./interfaces/ISupport.js'); require('./interfaces/ITest.js'); require('./interfaces/IUser.js'); -require('./interfaces/IStatus.js'); \ No newline at end of file +require('./interfaces/IStatus.js');