UNPKG

http2-client

Version:

Drop-in replacement for Nodes http and https that transparently make http request to both http1 / http2 server, it's using the ALPN protocol

11 lines (10 loc) 239 B
const http = require('http'); const h1Target = 'http://www.example.com/'; const req1 = http.request(h1Target, (res)=>{ console.log(` Url : ${h1Target} Status : ${res.statusCode} HttpVersion : ${res.httpVersion} `); }); req1.end();