Помогите с 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
    2 Posts
    412 Views
  • 0 Votes
    8 Posts
    703 Views
  • 0 Votes
    1 Posts
    414 Views
  • 0 Votes
    4 Posts
    812 Views
  • 0 Votes
    3 Posts
    521 Views