From 817b49830571b45a8aec6b1fc1525434f5798c58 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Fri, 23 Aug 2019 12:57:56 +0200 Subject: [PATCH] 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'. --- test/application/respond.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/application/respond.js b/test/application/respond.js index 32f93cf34..14f13211d 100644 --- a/test/application/respond.js +++ b/test/application/respond.js @@ -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; });