如何解决将 http 请求卷曲到 node-red
我对 node-red 非常陌生,对向 node-red 发送 http 请求一无所知。我一直在尝试这种方法来向 node-red 发送请求,但它给了我状态代码 0。
var xhr = new XMLHttpRequest();
xhr.open("POST","https://my.node.com:port/endpoint",true);
xhr.setRequestHeader('Content-Type','application/json');
xhr.send(JSON.stringify({
data: "data"
}));
console.log(xhr.status);
我的前辈建议我使用 curl 命令 - 但我不知道该怎么做。我不习惯使用 curl,也没有时间花时间深入探索,因为我可用的时间有限。我尝试使用此方法,但返回错误 msg undefined
msg.payload = "data to post";
msg.headers = {};
msg.headers['content-type'] = 'application/json';
return msg;
如何向 node-red 发送 http 请求?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。