Merge pull request #259 from dead-horse/fix-length

fix length when .body is missing
This commit is contained in:
Jonathan Ong 2014-04-12 21:43:22 -07:00
commit 430246c114
2 changed files with 3 additions and 0 deletions

View File

@ -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

View File

@ -288,6 +288,7 @@ describe('app.respond', function(){
request(server)
.get('/')
.expect(400)
.expect('Content-Length', 11)
.expect('Bad Request', done);
})
})