Skip to content

Commit

Permalink
Test 304 doesn't throw
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechilds committed Mar 9, 2017
1 parent aceed32 commit d872646
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -56,6 +61,16 @@ test('error with code', async t => {
}
});

test('304 doesn\'t throw', async t => {
try {
const response = await got(`${s.url}/304`);
t.is(response.statusCode, 304);
t.is(response.body, '');
} catch (err) {
t.fail('Exception was thrown');
}
});

test('buffer on encoding === null', async t => {
const data = (await got(s.url, {encoding: null})).body;
t.truthy(Buffer.isBuffer(data));
Expand Down

0 comments on commit d872646

Please sign in to comment.