Skip to content

Instantly share code, notes, and snippets.

@mamannn
Last active March 15, 2023 14:44
Show Gist options
  • Save mamannn/d1438f99d81fd1acc009f669e45a813d to your computer and use it in GitHub Desktop.
Save mamannn/d1438f99d81fd1acc009f669e45a813d to your computer and use it in GitHub Desktop.
http1
import got from "got";
import hpagent from "hpagent";
const proxy = "http://127.0.0.1:3128";
const agent = {
http: new hpagent.HttpProxyAgent({
proxy,
keepAlive: true,
keepAliveMsecs: 1000,
maxSockets: 256,
maxFreeSockets: 256,
scheduling: "lifo",
}),
https: new hpagent.HttpsProxyAgent({
proxy,
keepAlive: true,
keepAliveMsecs: 1000,
maxSockets: 256,
maxFreeSockets: 256,
scheduling: "lifo",
}),
};
// got request
async function main() {
const url = "https://9ho21eclbd.execute-api.us-east-1.amazonaws.com/hello";
const options = {
url,
method: "get",
agent,
// http2: true,
};
const res = await got(options);
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