Browse Source

add test to ensure gzip works in stream mode

node-7
Sindre Sorhus 9 years ago
parent
commit
7d0a45a828
  1. 1
      package.json
  2. 5
      test/gzip.js

1
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",

5
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`);

Loading…
Cancel
Save