【发布时间】:2017-01-01 18:44:43
【问题描述】:
我正在尝试在 node.js 中返回另一个站点的发布请求的正文,但下面的函数没有返回任何内容
// 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 时,我也得到了正确的正文,但是返回不起作用。我做错了什么?
【问题讨论】:
标签: javascript mysql node.js return undefined