敏感词检测接口"errcode":47001,",数据已经json序列化
发布于 5 年前 作者 jun46 20412 次浏览 来自 问答

var getMsg = function (_token,content) {

return new Promise(function (resolve, reject) {

var postData = {

content: content

};

postData = JSON.stringify(postData)

console.log(‘after’)

console.log(postData)

var options = {

hostname: api.weixin.qq.com,

path: ‘/wxa/msg_sec_check?access_token=’ + _token,

port:443,

method: ‘POST’,

headers:{

‘Referer’: https://k3fcz9gw.qcloud.la/weapp/minganci/,

‘Content-Type’: ‘application/json’,

‘Content-Length’: postData.length,

}

};

var msg = ‘’;

const reqB = https.request(options, (res) => {

console.log('STATUS: ’ + res.statusCode);

console.log('HEADERS: ’ + JSON.stringify(res.headers));

res.on(‘data’, function (data) {

console.log(‘data’)

msg += data;

});

res.on(‘end’, function () {

console.log(‘end’)

resolve(msg)

});

});

reqB.write(postData);

reqB.on(‘error’, function (e){

console.log(‘error’)

msg = e;

resolve(msg)

});

reqB.end();

})

}

1 回复

这是数据格式及debug结果

为什么中英文混搭会出错?编码问题吗

回到顶部