From 7d0a45a8284c7e2c53a9bda025b2b9d57d7bf93c Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Tue, 10 May 2016 16:01:02 +0700 Subject: [PATCH] add test to ensure gzip works in stream mode --- package.json | 1 + test/gzip.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/package.json b/package.json index 35a9fa9..8861125 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "ava": "^0.14.0", "coveralls": "^2.11.4", "get-port": "^2.0.0", + "get-stream": "^1.1.0", "into-stream": "^2.0.0", "nyc": "^6.0.0", "pem": "^1.4.4", diff --git a/test/gzip.js b/test/gzip.js index f9d6e46..4aeba09 100644 --- a/test/gzip.js +++ b/test/gzip.js @@ -1,5 +1,6 @@ import zlib from 'zlib'; import test from 'ava'; +import getStream from 'get-stream'; import got from '../'; import {createServer} from './helpers/server'; @@ -37,6 +38,10 @@ test('decompress content', async t => { t.is((await got(s.url)).body, testContent); }); +test('decompress content - stream', async t => { + t.is(await getStream(got.stream(s.url)), testContent); +}); + test('handles gzip error', async t => { try { await got(`${s.url}/corrupted`);