我正在尝试运行以下脚本来调用我的api 3次(遍历数组),并使用POST方法创建新记录。我在日志中看不到api调用已启动。谁能看到我要去哪里错了?
var tens = "rec1, rec2, re3"
console.log(tens);
var letters = tens.split(',').map(string=>string.trim());
console.log(letters);
async function callAPIs(letters) {
responses = [];
for (let i = 0; i < letters.length; i++) {
var apiRequest = await http.request({
'endpoint': 'test',
'path':'/api/table/records',
'method': 'POST',
"headers": {
"Authorization": "Basic xxxxxxxxx=",
"Content-Type": "application/json"
}
})
apiRequest.send(data)
apiRequest.end((data) => {
responses.push(data)
});
};
return responses
}
var data = {};
var caller_id = "user1";
data.caller_id = caller_id;
console.log(caller_id);