使用Node-Red,我试图为http请求设置正确的参数,但我不能这样做。



curl的查询是这样的:
curl -H "Content-Type: application/json" -X GET -d '{"auth_key":"xf79rra", "payload":null}' https://retepaiot.it/sensordata/0018b1213而且它是有效的。
我想我在传递auth_key和有效负载时犯了一些错误(它们不是URL参数)。我使用函数来准备消息:
msg.headers = {
"Content-Type": "application/json"
};
msg.payload = {auth_key:"xf7xxxx9rra",
payload:null};
return msg;和对URL的http请求:
https://retepaiot.it/sensordata/001xxxx1213返回的消息为:
{ "message": "Failed to decode JSON object: Expecting value: line 1 column 1 (char 0)"}发布于 2020-02-23 18:10:23
看看节点配置底部的"Return type“,您已经显式地请求了一个JSON对象
https://stackoverflow.com/questions/60356824
复制相似问题