0
我试图返回node.js的另一个站点的POST请求的身体,但下面的函数不返回任何的Node.js的request.POST返回undefined
// returns "undefined"
mysqlVerify = (socialclub_id, session_id) => {
request({
url: 'http://myapi.site/VerifyUser',
method: 'post',
form: {
socialclub_id: socialclub_id,
session_id: session_id
}
}, (error, response, body) => {
if(error) {
return false // this isnt returning
} else {
console.log(response.statusCode, body)
return body == "1" // this isnt returning
}
})
}
其他网站正在接收帖子请求,并且当我使用console.log
时,我也收到了正确的回复,但回报不起作用。我究竟做错了什么?