fetch запрос перестал работать. Ошибка Error:Window.fetch: Cannot convert value in record branch of (sequence> or record) to ByteString because the character at index 512 has value 8230 which is greater than 255.
const Ozurlurl = 'https://dostavka.ru/api/reports/agent/warehouse_remains?filter=All&stateFilter=Giveout&postingNumber=&take=50&skip=0';
async function getOzn(Ozurl) {
let response = await fetch(Ozurl, {
method: 'GET', //
mode: 'cors', //
cache: 'no-cache',
credentials: 'same-origin',
headers: {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6Ik',
'Content-Type': 'application/json',
'Accept': ["application/json", "text/plain", "*/*"]
} });
if (response.ok) {
let json = await response.json();
return json;
} else
throw new Error(`${response.status}: ${response.statusText}`);
}
function printDataOZ(json) {
if (json)
var testOO = document.getElementById('statOZ');
if(!testOO) {
testOO = document.createElement("div");
testOO.id = 'statOZ';
document.body.appendChild(testOO);
}
testOO.innerHTML = `<div class="My__OZ">${'Количество'+' -'+json.count+' шт'}`;
console.log(testOO);
console.log(json);
setTimeout(() => getOzn(Ozurlurl).then(printDataOZ).catch(loose), 100000) //
}
function loose(error) {
console.log('Error:' + error.message);
}
getOzn(Ozurlurl).then(printDataOZ).catch(loose);