From d615b0bd2bb44118702432f1562d686f45d3a722 Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Fri, 24 Apr 2015 00:28:43 +0500 Subject: [PATCH] use returned value from pipe method as new response --- index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/index.js b/index.js index 1037017..8f309d0 100644 --- a/index.js +++ b/index.js @@ -112,9 +112,7 @@ function got(url, opts, cb) { } if (['gzip', 'deflate'].indexOf(res.headers['content-encoding']) !== -1) { - var unzip = zlib.createUnzip(); - res.pipe(unzip); - res = unzip; + res = res.pipe(zlib.createUnzip()); } if (statusCode < 200 || statusCode > 299) {