use byteLength when calculating content-length

This commit is contained in:
Karl Böhlmark 2013-09-02 23:55:38 +02:00
parent 37a7457d28
commit 520df772ef

View file

@ -209,7 +209,7 @@ function respond(next){
// body: json
body = JSON.stringify(body, null, this.app.jsonSpaces);
this.set('Content-Length', body.length);
this.set('Content-Length', Buffer.byteLength(body));
this.set('Content-Type', 'application/json');
if (head) return res.end();
res.end(body);