test: fix body test (#1375)
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'.
This commit is contained in:
parent
f75d445535
commit
817b498305
1 changed files with 3 additions and 0 deletions
|
@ -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');
|
||||
});
|
||||
});
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue