Skip to content

Instantly share code, notes, and snippets.

@mamannn
Created March 15, 2023 14:45
Show Gist options
  • Save mamannn/ac92d3e34d098c99063e8b707088569d to your computer and use it in GitHub Desktop.
Save mamannn/ac92d3e34d098c99063e8b707088569d to your computer and use it in GitHub Desktop.
http2
import got from "got";
import http2 from "http2-wrapper";
const httpsProxy = new http2.proxies.Http2OverHttp({
proxyOptions: {
url: "http://localhost:3128",
// For demo purposes only!
rejectUnauthorized: false,
},
});
async function main() {
const res = await got.get(
"https://9ho21eclbd.execute-api.us-east-1.amazonaws.com/hello",
{
followRedirect: false,
http2: true,
agent: {
https: httpsProxy,
http: httpsProxy,
http2: httpsProxy,
},
}
);
console.log(res.body);
}
main().catch(console.error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment