Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation missing for agent option #1669

Closed
thomas-riccardi opened this issue Jul 7, 2015 · 3 comments
Closed

Documentation missing for agent option #1669

thomas-riccardi opened this issue Jul 7, 2015 · 3 comments

Comments

@thomas-riccardi
Copy link

request accepts a http/https Agent as agent option, but it's not documented.
What is documented is how to pass a pool of agents as pool option, but the code first checks if self.agent exists before using self.pool to get the http agent:

request/request.js

Lines 486 to 490 in 2ca0633

if (self.pool === false) {
self.agent = false
} else {
self.agent = self.agent || self.getNewAgent()
}

This should be documented & tested, or it should be removed... Otherwise we cannot rely on it.

@simov
Copy link
Member

simov commented Jul 9, 2015

I agree there are other options missing from the docs as well, like agentClass and agentOptions mentioned here #1637

@simov
Copy link
Member

simov commented Jul 10, 2015

@triccardi-systran see #1671

@tvdstaaij
Copy link

It sure seems to work, I just passed in a https.Agent object with the keepAlive option set to true (Node 0.12) and verified using an external TCP analysis tool that the connections are kept alive and reused, while this is not the case when the custom agent is not passed in.

This is a very useful feature but it took me over an hour of googling and analyzing source code to find it, so seconding the documentation request. I also suggest updating the documentation for pool so that the differences and use cases for the two are made clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants