Помогите с 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
    5 Posts
    637 Views
  • 0 Votes
    2 Posts
    562 Views
  • 0 Votes
    2 Posts
    585 Views
  • 0 Votes
    4 Posts
    987 Views
  • 0 Votes
    4 Posts
    1109 Views