Skip to content

Commit

Permalink
test: fix body test (#1375)
Browse files Browse the repository at this point in the history
Setting body will set the content-length header. Unless the
corresponding number of bytes are sent the response will
be aborted and not emit 'end'.
  • Loading branch information
ronag authored and dead-horse committed Aug 23, 2019
1 parent f75d445 commit 817b498
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/application/respond.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe('app.respond', () => {
res.statusCode = 200;
setImmediate(() => {
res.setHeader('Content-Type', 'text/plain');
res.setHeader('Content-Length', '3');
res.end('lol');
});
});
Expand All @@ -41,6 +42,7 @@ describe('app.respond', () => {
const res = ctx.res;
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.setHeader('Content-Length', '3');
res.end('lol');
ctx.set('foo', 'bar');
});
Expand All @@ -65,6 +67,7 @@ describe('app.respond', () => {
const res = ctx.res;
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.setHeader('Content-Length', '3');
res.end('lol');
ctx.status = 201;
});
Expand Down

0 comments on commit 817b498

Please sign in to comment.