Last active
March 15, 2023 14:44
-
-
Save mamannn/d1438f99d81fd1acc009f669e45a813d to your computer and use it in GitHub Desktop.
http1
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 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