Fix content-length bug for api.js

Well, it finally happened.  I made an assumption about text and it bit me in the butt.  Protip: not everything is 1 byte per character!
This commit is contained in:
calzoneman 2013-04-25 16:36:56 -05:00
parent a88088f2d6
commit ea4ed864c8

3
api.js
View file

@ -92,9 +92,10 @@ function handleChannelData(params, req, res) {
}
var response = JSON.stringify(data, null, 4);
var len = unescape(encodeURIComponent(response)).length;
res.setHeader("Content-Type", "application/json");
res.setHeader("Content-Length", response.length);
res.setHeader("Content-Length", len);
res.end(response);
}