From 6b4e198055b28940bea19d5f9a5480bfe03d0c6b Mon Sep 17 00:00:00 2001 From: Alexey Ermolaev Date: Tue, 7 Aug 2018 20:33:35 +1000 Subject: [PATCH] Enable multi-byte encoding for parameters Fixed bug occurring when sending multi-byte encoded strings in parameters. Length was calculated incorrectly and server would stop receiving message before it's end. --- lib/client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/client.js b/lib/client.js index ebd9cf1..fbd15ff 100644 --- a/lib/client.js +++ b/lib/client.js @@ -68,7 +68,7 @@ Client.prototype.call = function(options, callback, id){ path: this.path, headers:{ 'content-type':(this.method=='POST') ? 'application/x-www-form-urlencoded' :'application/json', - 'content-length':(requestData).length + 'content-length':Buffer.byteLength(requestData) } }; if(this.authNeeded){ @@ -122,4 +122,4 @@ Client.prototype.call = function(options, callback, id){ request.end(requestData); }; -module.exports = Client; \ No newline at end of file +module.exports = Client;