Created
March 15, 2023 14:45
-
-
Save mamannn/ac92d3e34d098c99063e8b707088569d to your computer and use it in GitHub Desktop.
http2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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