使用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;
和http请求URL:
https://retepaiot.it/sensordata/001xxxx1213
返回的消息是:
{ "message": "Failed to decode JSON object: Expecting value: line 1 column 1 (char 0)"}
查看节点配置底部的“返回类型”,您已明确要求JSON对象