我正在发送请求,要求在请求正文中发送一个列表数组但是我反复原生地再次收到错误“NETWORK REQUEST FAILED”。下面提到了一些代码。
var params = {
grocery_list_name: 'MY_grocery_LIST',
items: [{
"product":"320",
"price" : "6.99",
"quantity" : "2",
"special_deal":"1",
"template":"1"
},{
"product":"321",
"price" : "7.99",
"quantity" : "3",
"special_deal":"2",
"template":"2"
},]
};
try {return fetch(URL, { method: 'POST', headers: {
'Authorization': 'bearer AtE9slkuafhebbjKkYe0tTimMZc',
'Content-Type': 'application/json'},
body: JSON.stringify(params),})
.then(function(response){
console.log(response);
return response.json();
})
} catch (error) {
console.error(error);
} finally { }