Uses the appropriate Agent subclass based off of the "proxy" environment variables that are currently set.

An LRU cache is used, to prevent unnecessary creation of proxy http.Agent instances.

Hierarchy

Constructors

Properties

cache: LRUCache<string, Agent> = ...

Cache for Agent instances.

connectOpts?: ProxyAgentOptions
freeSockets: ReadOnlyDict<Socket[]>
getProxyForUrl: GetProxyForUrlCallback
httpAgent: Agent
httpsAgent: Agent
keepAlive: boolean
maxFreeSockets: number
maxSockets: number
maxTotalSockets: number
options: Partial<TcpNetConnectOpts & ConnectionOptions>
requests: ReadOnlyDict<IncomingMessage[]>
sockets: ReadOnlyDict<Socket[]>
captureRejectionSymbol: typeof captureRejectionSymbol
captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

defaultMaxListeners: number
errorMonitor: typeof errorMonitor

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Accessors

  • get defaultPort(): number
  • Returns number

  • set defaultPort(v): void
  • Parameters

    • v: number

    Returns void

  • get protocol(): string
  • Returns string

  • set protocol(v): void
  • Parameters

    • v: string

    Returns void

Methods

  • Parameters

    • event: string | symbol
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns ProxyAgent

  • Parameters

    Returns Promise<Agent>

  • Returns Duplex

  • Parameters

    • req: ClientRequest
    • options: AgentConnectOpts
    • cb: ((err, s?) => void)
        • (err, s?): void
        • Parameters

          • err: null | Error
          • Optional s: Duplex

          Returns void

    Returns void

  • Destroy any sockets that are currently in use by the agent. It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled, then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise, sockets may hang open for quite a long time before the server terminates them.

    Returns void

  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

  • Returns (string | symbol)[]

  • Returns number

  • Determine whether this is an http or https request.

    Parameters

    Returns boolean

  • Parameters

    • event: string | symbol

    Returns number

  • Parameters

    • event: string | symbol

    Returns Function[]

  • Parameters

    • event: string | symbol
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns ProxyAgent

  • Parameters

    • event: string | symbol
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns ProxyAgent

  • Parameters

    • event: string | symbol
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns ProxyAgent

  • Parameters

    • event: string | symbol
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns ProxyAgent

  • Parameters

    • event: string | symbol
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns ProxyAgent

  • Parameters

    • event: string | symbol

    Returns Function[]

  • Parameters

    • Optional event: string | symbol

    Returns ProxyAgent

  • Parameters

    • event: string | symbol
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns ProxyAgent

  • Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

    Deprecated

    since v4.0.0

  • Parameters

    • emitter: EventEmitter
    • event: string

    Returns AsyncIterableIterator<any>

  • Parameters

    • emitter: NodeEventTarget
    • event: string | symbol

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string

    Returns Promise<any[]>

Generated using TypeDoc