Помогите с 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);
    
  • благодарю

  • 0 Votes
    3 Posts
    453 Views
  • 1 Votes
    23 Posts
    2085 Views
  • 0 Votes
    4 Posts
    429 Views
  • -1 Votes
    14 Posts
    2799 Views
  • 0 Votes
    4 Posts
    945 Views