• Get a new agent to use for a given URL.

    For keep-alive behavior to work, the agent must be shared across requests but this is left for the calling code to manage. We do this because once the agent isn't needed (such as at the end of a request), we want to destroy it. Otherwise, it can hang around keeping sockets open which can lead to retaining large chunks of memory and creating memory leaks.

    Parameters

    • url: URL

    Returns Agent | Agent

Generated using TypeDoc