content-length header should be byte length, not character length.

Dmitry Minkovsky 2014-06-27 08:45:17 -07:00
parent 35ac068ab4
commit e29dddb014

2
FAQ.md

@ -47,7 +47,7 @@ http.createServer(function(req, res) {
pg.query(..., function(err, result) {
//NOTE: error handling not present
var json = JSON.stringify(result.rows);
res.writeHead(200, {'content-type':'application/json', 'content-length':json.length});
res.writeHead(200, {'content-type':'application/json', 'content-length':Buffer.byteLength(json)});
res.end(json);
});
})