From 0031783bdf2ff81984c7b9b845ec9965a75ca11c Mon Sep 17 00:00:00 2001 From: Ulrik Gammelby Date: Thu, 10 Nov 2016 19:05:44 +0000 Subject: [PATCH] fix bad content-length on unicode input --- lib/client.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index fa72031..03415f5 100644 --- a/lib/client.js +++ b/lib/client.js @@ -13,6 +13,7 @@ var endpoint = route[0]; var method = route[1]; var that = this; + var len = (data) ? Buffer.from(data).length : 0; var options = { host: config.RECURLY_HOST, port: 443, @@ -21,7 +22,7 @@ headers: { Authorization: "Basic " + (new Buffer(config.API_KEY)).toString('base64'), Accept: 'application/xml', - 'Content-Length': (data) ? data.length : 0, + 'Content-Length': len, 'User-Agent': "node-recurly/" + pjson.version } };