Browse Source

Add test for unexpected EOF when decompressing content

node-7
Kevin Martensson 8 years ago
parent
commit
e25457da16
  1. 11
      test/gzip.js

11
test/gzip.js

@ -31,6 +31,13 @@ test.before('setup', async () => {
res.end('Not gzipped content');
});
s.on('/missing-data', (req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.setHeader('Content-Encoding', 'gzip');
zlib.gzip(testContent, (_, data) => res.end(data.slice(0, -1)));
});
await s.listen(s.port);
});
@ -61,6 +68,10 @@ test('do not break HEAD responses', async t => {
t.is((await got.head(s.url)).body, '');
});
test('ignore missing data', async t => {
t.is((await got(`${s.url}/missing-data`)).body, testContent);
});
test.after('cleanup', async () => {
await s.close();
});

Loading…
Cancel
Save