Browse Source

Test 304 doesn't throw

allow-304
Luke Childs 8 years ago
parent
commit
4910ef8df5
  1. 13
      test/http.js

13
test/http.js

@ -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));

Loading…
Cancel
Save