mirror of https://github.com/calzoneman/sync.git
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:
parent
a88088f2d6
commit
ea4ed864c8
3
api.js
3
api.js
|
@ -92,9 +92,10 @@ function handleChannelData(params, req, res) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var response = JSON.stringify(data, null, 4);
|
var response = JSON.stringify(data, null, 4);
|
||||||
|
var len = unescape(encodeURIComponent(response)).length;
|
||||||
|
|
||||||
res.setHeader("Content-Type", "application/json");
|
res.setHeader("Content-Type", "application/json");
|
||||||
res.setHeader("Content-Length", response.length);
|
res.setHeader("Content-Length", len);
|
||||||
res.end(response);
|
res.end(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue