File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1750,6 +1750,26 @@ got('https://sindresorhus.com', {
1750
1750
});
1751
1751
` ` `
1752
1752
1753
+ Otherwise, you can use the [` hpagent` ](https://github.com/delvedor/hpagent) package, which keeps the internal sockets alive to be reused.
1754
+
1755
+ ` ` ` js
1756
+ const got = require (' got' );
1757
+ const {HttpsProxyAgent } = require (' hpagent' );
1758
+
1759
+ got (' https://sindresorhus.com' , {
1760
+ agent: {
1761
+ https: new HttpsProxyAgent ({
1762
+ keepAlive: true ,
1763
+ keepAliveMsecs: 1000 ,
1764
+ maxSockets: 256 ,
1765
+ maxFreeSockets: 256 ,
1766
+ scheduling: ' lifo' ,
1767
+ proxy: ' https://localhost:8080'
1768
+ })
1769
+ }
1770
+ });
1771
+ ` ` `
1772
+
1753
1773
Alternatively, use [` global - agent` ](https://github.com/gajus/global-agent) to configure a global proxy for all HTTP/HTTPS traffic in your program.
1754
1774
1755
1775
Read the [` http2- wrapper` ](https://github.com/szmarczak/http2-wrapper/#proxy-support) docs to learn about proxying for HTTP/2.
You can’t perform that action at this time.
0 commit comments