From 5eb762ff663063776fbf94b1dd91361c96fac77e Mon Sep 17 00:00:00 2001 From: leafTheFish <103831852+leafTheFish@users.noreply.github.com> Date: Sun, 23 Oct 2022 13:21:59 +0800 Subject: [PATCH] Update gqcq_wx.js --- gqcq_wx.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gqcq_wx.js b/gqcq_wx.js index 0aa2df3..c5488d2 100644 --- a/gqcq_wx.js +++ b/gqcq_wx.js @@ -65,7 +65,11 @@ class UserInfo { } else { urlObject.body = paramIn.body } - urlObject.headers['Content-Length'] = urlObject.body ? Buffer.byteLength(urlObject.body, 'utf8') : 0 + if($.isNode()) { + urlObject.headers['Content-Length'] = urlObject.body ? Buffer.byteLength(urlObject.body, 'utf8') : 0 + } else { + urlObject.headers['Content-Length'] = urlObject.body ? urlObject.body.length : 0 + } } if(paramIn.urlObjectParam) Object.assign(urlObject,paramIn.urlObjectParam); if(paramIn.headerParam) Object.assign(urlObject.headers,paramIn.headerParam);