|
|
@ -15,6 +15,11 @@ test.before('setup', async () => { |
|
|
|
res.end(); |
|
|
|
}); |
|
|
|
|
|
|
|
s.on('/304', (req, res) => { |
|
|
|
res.statusCode = 304; |
|
|
|
res.end(); |
|
|
|
}); |
|
|
|
|
|
|
|
s.on('/404', (req, res) => { |
|
|
|
setTimeout(() => { |
|
|
|
res.statusCode = 404; |
|
|
@ -56,6 +61,14 @@ test('error with code', async t => { |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
test('status code 304 doesn\'t throw', async t => { |
|
|
|
const p = got(`${s.url}/304`); |
|
|
|
await t.notThrows(p); |
|
|
|
const response = await p; |
|
|
|
t.is(response.statusCode, 304); |
|
|
|
t.is(response.body, ''); |
|
|
|
}); |
|
|
|
|
|
|
|
test('buffer on encoding === null', async t => { |
|
|
|
const data = (await got(s.url, {encoding: null})).body; |
|
|
|
t.truthy(Buffer.isBuffer(data)); |
|
|
|