Permalink
Browse files

Fix connection.request to work with UTF-8 data

  • Loading branch information...
1 parent f278510 commit 85525855135f5683e93c1ee1ea0f4ceabdb20c3e @wadey wadey committed May 10, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/ranger/connection.js
View
@@ -88,7 +88,7 @@ exports.Connection = function (account, token) {
method: method,
headers: {
"Authorization": authorization,
- "Content-Type": "application/json"
+ "Content-Type": "application/json; charset=utf-8"
}
};
@@ -99,7 +99,7 @@ exports.Connection = function (account, token) {
} else {
if (body) {
jsonBody = JSON.stringify(body);
- options.headers["Content-Length"] = jsonBody.length;
+ options.headers["Content-Length"] = Buffer.byteLength(jsonBody);
} else {
options.headers["Content-Length"] = 0;
}

0 comments on commit 8552585

Please sign in to comment.