diff --git a/lib/application.js b/lib/application.js index 12c3ea0..0020bbc 100644 --- a/lib/application.js +++ b/lib/application.js @@ -190,6 +190,8 @@ function *respond(next) { // status body this.type = 'text'; body = status[code]; + if (body) this.length = Buffer.byteLength(body); + return res.end(body); } // Buffer body diff --git a/test/application.js b/test/application.js index 8e0e25f..8ee040c 100644 --- a/test/application.js +++ b/test/application.js @@ -288,6 +288,7 @@ describe('app.respond', function(){ request(server) .get('/') .expect(400) + .expect('Content-Length', 11) .expect('Bad Request', done); }) })