Skip to content

Commit 817b498

Browse files
ronagdead-horse
authored andcommitted
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'.
1 parent f75d445 commit 817b498

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/application/respond.js

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ describe('app.respond', () => {
2020
res.statusCode = 200;
2121
setImmediate(() => {
2222
res.setHeader('Content-Type', 'text/plain');
23+
res.setHeader('Content-Length', '3');
2324
res.end('lol');
2425
});
2526
});
@@ -41,6 +42,7 @@ describe('app.respond', () => {
4142
const res = ctx.res;
4243
res.statusCode = 200;
4344
res.setHeader('Content-Type', 'text/plain');
45+
res.setHeader('Content-Length', '3');
4446
res.end('lol');
4547
ctx.set('foo', 'bar');
4648
});
@@ -65,6 +67,7 @@ describe('app.respond', () => {
6567
const res = ctx.res;
6668
res.statusCode = 200;
6769
res.setHeader('Content-Type', 'text/plain');
70+
res.setHeader('Content-Length', '3');
6871
res.end('lol');
6972
ctx.status = 201;
7073
});

0 commit comments

Comments
 (0)