From 716e487038fca364648f61c6c432063f1d2c41c0 Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 20 Apr 2016 01:26:45 +0200 Subject: [PATCH] Fixing handling of compression errors --- lib/adapters/http.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/adapters/http.js b/lib/adapters/http.js index 3c3970a..8e4558a 100644 --- a/lib/adapters/http.js +++ b/lib/adapters/http.js @@ -103,6 +103,11 @@ module.exports = function httpAdapter(resolve, reject, config) { } }); + stream.on('error', function handleStreamError(err) { + if (aborted) return; + reject(err); + }); + stream.on('end', function handleStreamEnd() { var d = Buffer.concat(responseBuffer); if (config.responseType !== 'arraybuffer') {