Skip to content

Docs imply that http globalAgent is created with keepAlive: false #48821

Closed
@janeklb

Description

@janeklb

Affected URL(s)

https://nodejs.org/api/http.html#new-agentoptions

Description of the problem

The docs state:

The default http.globalAgent that is used by http.request() has all of these values set to their respective defaults.

Whereas globalAgent is built with

module.exports = {
  Agent,
  globalAgent: new Agent({ keepAlive: true, scheduling: 'lifo', timeout: 5000 }),
};

https://github.com/nodejs/node/blob/339eb10619ada1b482371ee244585de7f4a58552/lib/_http_agent.js#L552C1-L555C3

the only default there is scheduling: 'lifo'; keepAlive: true and timeout: 5000 are overrides.


(the history part of the globalAgent docs states "The agent now uses HTTP Keep-Alive by default." so that part is ok ✔️)

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.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