From fd0c959355e85afa76d1728b7c7bd93a05e004a4 Mon Sep 17 00:00:00 2001 From: drawski Date: Wed, 15 May 2019 21:35:09 +0200 Subject: [PATCH] Unzip response body only for statuses != 204 (#1129) --- lib/adapters/http.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/adapters/http.js b/lib/adapters/http.js index e302bc0e46..06169ff2cb 100755 --- a/lib/adapters/http.js +++ b/lib/adapters/http.js @@ -188,7 +188,7 @@ module.exports = function httpAdapter(config) { case 'compress': case 'deflate': // add the unzipper to the body stream processing pipeline - stream = stream.pipe(zlib.createUnzip()); + stream = (res.statusCode === 204) ? stream : stream.pipe(zlib.createUnzip()); // remove the content-encoding in order to not confuse downstream operations delete res.headers['content-encoding'];