Skip to content

Difference between http.request({keepAlive}) and http.request({agent: {keepAlive}}) #1300

Closed
@vvo

Description

Hi,

I have been playing with keepAlive in io.js and node 0.12. Something strange is that the documentation states that one could use:

http.request({keepAlive: true})

But this line did not trigger keepAlive on my requests. I could not find a code path using it in the nodejs codebase.

Is this a mistake or am I missing something? Maybe agent keepAlive and request keepAlive are not the same thing, then maybe we could clarify things.

Using:

http.request({agent: http.Agent({keepAlive: true})})

works, as shown in the tests https://github.com/joyent/node/blob/857975d5e7e0d7bf38577db0478d9e5ede79922e/test/simple/test-http-agent-keepalive.js
https://github.com/iojs/io.js/blob/v1.x/test/parallel/test-http-agent-keepalive.js

Metadata

Assignees

Labels

httpIssues or PRs related to the http subsystem.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions