Skip to content

Commit

Permalink
Merge 7bb5ea6 into 9ce2752
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphyrus committed Sep 5, 2019
2 parents 9ce2752 + 7bb5ea6 commit 070d9c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/reqhandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function sendResponse(res, response) {
if (response) {
const responseStr = JSON.stringify(response);
res.setHeader('Content-Type', 'application/json');
res.setHeader('Content-Length', responseStr.length);
res.setHeader('Content-Length', Buffer.byteLength(responseStr));
res.write(responseStr);
} else {
// Respond 204 for notifications with no response
Expand All @@ -19,7 +19,7 @@ function sendError(res, statusCode, message) {
if (message) {
const formattedMessage = `{"error":"${message}"}`;
res.setHeader('Content-Type', 'application/json');
res.setHeader('Content-Length', formattedMessage.length);
res.setHeader('Content-Length', Buffer.byteLength(formattedMessage));
res.write(formattedMessage);
}
res.end();
Expand Down

0 comments on commit 070d9c5

Please sign in to comment.