gpt4 book ai didi

javascript - 如何从express js服务器发送http请求?

转载 作者:行者123 更新时间:2023-11-28 03:02:51 25 4
gpt4 key购买 nike

我正在尝试从我的后端向 linkedin 服务发送发布请求。

exports.GetAccessToken = function (req, res) {
var xhttp = new XMLHttpRequest();
var decoded = jwt.verify(req.query.jwt_token, MariaDB_config.PUB_key);
xhttp.onreadystatechange = function () { // handle request response
if (this.readyState === 4 && this.status === 200) {
console.log("answer : " + this.responseText);
}
};
xhttp.handleError()
// Send a post request
xhttp.open("POST", "https://www.linkedin.com/oauth/v2/accessToken?code=" + decoded.code + "privatestuff", true);
xhttp.send();
}

我收到以下错误:

TypeError: Cannot read property 'stack' of undefined

此方法到目前为止一直运行良好。

最佳答案

我错误地使用了“xhttp.handleError()”,我删除了它,现在它工作正常了。

关于javascript - 如何从express js服务器发送http请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60829125/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com