The agent function should take the Connection contructor options as argument (#1332)
This commit is contained in:
committed by
GitHub
parent
ea009da3b6
commit
8ec40547fb
4
lib/Connection.d.ts
vendored
4
lib/Connection.d.ts
vendored
@ -28,9 +28,9 @@ import * as https from 'https'
|
||||
import * as hpagent from 'hpagent'
|
||||
import { ConnectionOptions as TlsConnectionOptions } from 'tls'
|
||||
|
||||
export declare type agentFn = () => any;
|
||||
export declare type agentFn = (opts: ConnectionOptions) => any;
|
||||
|
||||
interface ConnectionOptions {
|
||||
export interface ConnectionOptions {
|
||||
url: URL;
|
||||
ssl?: TlsConnectionOptions;
|
||||
id?: string;
|
||||
|
||||
@ -53,7 +53,7 @@ class Connection {
|
||||
}
|
||||
|
||||
if (typeof opts.agent === 'function') {
|
||||
this.agent = opts.agent()
|
||||
this.agent = opts.agent(opts)
|
||||
} else if (opts.agent === false) {
|
||||
this.agent = undefined
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user