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);