Помогите с node



  • Пытаюсь найти возможность сделать http2.0 запросы, нашел модуль с таким примером:

    const { fetch } = require('fetch-h2');
     
    fetch("https://google.com", { method: "GET" })
    .then(response => {
        console.log(response.status);
        console.log(response.httpVersion);
     
        return response.text(); 
    }) 
    .then(text => console.log(text));
    

    В visual studiuo все работает в басе в консоль ничего не выводится. В чем ошибка? Либо может кто знает другой модуль для http2.0 запросов?



  • @qash,

    const { fetch } = require('fetch-h2');
     
    let response = await fetch("https://google.com", { method: "GET" });
    
    console.log(response.status);
    console.log(response.httpVersion);
    
    let text = await response.text();
    
    console.log(text);
    


  • благодарю


Log in to reply
 

  • 7
  • 4
  • 6
  • 4
  • 38
  • 14
  • 5
  • 5