@Alekcey_s

Перестал работать fetch запрос?

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);
  • Вопрос задан
  • 114 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
КРАФТТЕК Санкт-Петербург
от 60 000 до 80 000 ₽
Brightdata Тель-Авив
от 5 500 до 6 500 $
Rocket Брянск
от 60 000 до 100 000 ₽
21 мая 2024, в 21:01
29999 руб./за проект
21 мая 2024, в 21:00
2000 руб./за проект
21 мая 2024, в 20:43
1000 руб./в час