Constructors

Accessors

  • get request(): undefined | RequestFunction
  • Custom request function. The main purpose of this is to support HTTP2 using a wrapper.

    Returns undefined | RequestFunction

    http.request | https.request
    
  • set request(value): void
  • Parameters

    Returns void

  • get agent(): Agents
  • An object representing http, https and http2 keys for http.Agent, https.Agent and http2wrapper.Agent instance. This is necessary because a request to one protocol might redirect to another. In such a scenario, Got will switch over to the right protocol agent for you.

    If a key is not present, it will default to a global agent.

    Returns Agents

    import got from 'got';
    import HttpAgent from 'agentkeepalive';

    const {HttpsAgent} = HttpAgent;

    await got('https://sindresorhus.com', {
    agent: {
    http: new HttpAgent(),
    https: new HttpsAgent()
    }
    });
  • set agent(value): void
  • Parameters

    Returns void

  • get h2session(): undefined | ClientHttp2Session
  • Returns undefined | ClientHttp2Session

  • set h2session(value): void
  • Parameters

    Returns void

  • get decompress(): boolean
  • Decompress the response automatically.

    This will set the accept-encoding header to gzip, deflate, br unless you set it yourself.

    If this is disabled, a compressed response is returned as a Buffer. This may be useful if you want to handle decompression yourself or stream the raw compressed data.

    Returns boolean

    true
    
  • set decompress(value): void
  • Parameters

    • value: boolean

    Returns void

  • get timeout(): Delays
  • Milliseconds to wait for the server to end the response before aborting the request with got.TimeoutError error (a.k.a. request property). By default, there's no timeout.

    This also accepts an object with the following fields to constrain the duration of each phase of the request lifecycle:

    • lookup starts when a socket is assigned and ends when the hostname has been resolved. Does not apply when using a Unix domain socket.
    • connect starts when lookup completes (or when the socket is assigned if lookup does not apply to the request) and ends when the socket is connected.
    • secureConnect starts when connect completes and ends when the handshaking process completes (HTTPS only).
    • socket starts when the socket is connected. See request.setTimeout.
    • response starts when the request has been written to the socket and ends when the response headers are received.
    • send starts when the socket is connected and ends with the request has been written to the socket.
    • request starts when the request is initiated and ends when the response's end event fires.

    Returns Delays

  • set timeout(value): void
  • Parameters

    Returns void

  • get prefixUrl(): string | URL
  • When specified, prefixUrl will be prepended to url. The prefix can be any valid URL, either relative or absolute. A trailing slash / is optional - one will be added automatically.

    Note: prefixUrl will be ignored if the url argument is a URL instance.

    Note: Leading slashes in input are disallowed when using this option to enforce consistency and avoid confusion. For example, when the prefix URL is https://example.com/foo and the input is /bar, there's ambiguity whether the resulting URL would become https://example.com/foo/bar or https://example.com/bar. The latter is used by browsers.

    Tip: Useful when used with got.extend() to create niche-specific Got instances.

    Tip: You can change prefixUrl using hooks as long as the URL still includes the prefixUrl. If the URL doesn't include it anymore, it will throw.

    Returns string | URL

    import got from 'got';

    await got('unicorn', {prefixUrl: 'https://cats.com'});
    //=> 'https://cats.com/unicorn'

    const instance = got.extend({
    prefixUrl: 'https://google.com'
    });

    await instance('unicorn', {
    hooks: {
    beforeRequest: [
    options => {
    options.prefixUrl = 'https://cats.com';
    }
    ]
    }
    });
    //=> 'https://cats.com/unicorn'
  • set prefixUrl(value): void
  • Parameters

    • value: string | URL

    Returns void

  • get body():
        | undefined
        | string
        | Generator<unknown, any, any>
        | AsyncGenerator<unknown, any, any>
        | Buffer
        | Readable
        | FormDataLike
  • Note #1: The body option cannot be used with the json or form option.

    Note #2: If you provide this option, got.stream() will be read-only.

    Note #3: If you provide a payload with the GET or HEAD method, it will throw a TypeError unless the method is GET and the allowGetBody option is set to true.

    Note #4: This option is not enumerable and will not be merged with the instance defaults.

    The content-length header will be automatically set if body is a string / Buffer / FormData / form-data instance, and content-length and transfer-encoding are not manually set in options.headers.

    Since Got 12, the content-length is not automatically set when body is a fs.createReadStream.

    Returns
        | undefined
        | string
        | Generator<unknown, any, any>
        | AsyncGenerator<unknown, any, any>
        | Buffer
        | Readable
        | FormDataLike

  • set body(value): void
  • Parameters

    Returns void

  • get form(): undefined | Record<string, any>
  • The form body is converted to a query string using (new URLSearchParams(object)).toString().

    If the Content-Type header is not present, it will be set to application/x-www-form-urlencoded.

    Note #1: If you provide this option, got.stream() will be read-only.

    Note #2: This option is not enumerable and will not be merged with the instance defaults.

    Returns undefined | Record<string, any>

  • set form(value): void
  • Parameters

    • value: undefined | Record<string, any>

    Returns void

  • get json(): unknown
  • JSON body. If the Content-Type header is not set, it will be set to application/json.

    Note #1: If you provide this option, got.stream() will be read-only.

    Note #2: This option is not enumerable and will not be merged with the instance defaults.

    Returns unknown

  • set json(value): void
  • Parameters

    • value: unknown

    Returns void

  • get url(): undefined | string | URL
  • The URL to request, as a string, a https.request options object, or a WHATWG URL.

    Properties from options will override properties in the parsed url.

    If no protocol is specified, it will throw a TypeError.

    Note: The query string is not parsed as search params.

    Returns undefined | string | URL

    await got('https://example.com/?query=a b'); //=> https://example.com/?query=a%20b
    await got('https://example.com/', {searchParams: {query: 'a b'}}); //=> https://example.com/?query=a+b

    // The query string is overridden by `searchParams`
    await got('https://example.com/?query=a b', {searchParams: {query: 'a b'}}); //=> https://example.com/?query=a+b
  • set url(value): void
  • Parameters

    • value: undefined | string | URL

    Returns void

  • get cookieJar(): undefined | ToughCookieJar | PromiseCookieJar
  • Cookie support. You don't have to care about parsing or how to store them.

    Note: If you provide this option, options.headers.cookie will be overridden.

    Returns undefined | ToughCookieJar | PromiseCookieJar

  • set cookieJar(value): void
  • Parameters

    Returns void

  • get signal(): undefined | AbortSignal
  • You can abort the request using AbortController.

    Returns undefined | AbortSignal

    import got from 'got';

    const abortController = new AbortController();

    const request = got('https://httpbin.org/anything', {
    signal: abortController.signal
    });

    setTimeout(() => {
    abortController.abort();
    }, 100);
  • set signal(value): void
  • Parameters

    Returns void

  • get ignoreInvalidCookies(): boolean
  • Ignore invalid cookies instead of throwing an error. Only useful when the cookieJar option has been set. Not recommended.

    Returns boolean

    false
    
  • set ignoreInvalidCookies(value): void
  • Parameters

    • value: boolean

    Returns void

  • get searchParams():
        | undefined
        | string
        | URLSearchParams
        | SearchParameters
  • Query string that will be added to the request URL. This will override the query string in url.

    If you need to pass in an array, you can do it using a URLSearchParams instance.

    Returns
        | undefined
        | string
        | URLSearchParams
        | SearchParameters

    import got from 'got';

    const searchParams = new URLSearchParams([['key', 'a'], ['key', 'b']]);

    await got('https://example.com', {searchParams});

    console.log(searchParams.toString());
    //=> 'key=a&key=b'
  • set searchParams(value): void
  • Parameters

    Returns void

  • get searchParameters(): unknown
  • Returns unknown

  • set searchParameters(_value): void
  • Parameters

    • _value: unknown

    Returns void

  • get dnsLookup(): undefined | {
        (hostname: string, family: IPFamily, callback: ((error: null | ErrnoException, address: string, family: IPFamily) => void)): void;
        (hostname: string, callback: ((error: null | ErrnoException, address: string, family: IPFamily) => void)): void;
        (hostname: string, options: LookupOptions & {
            all: true;
        }, callback: ((error: null | ErrnoException, result: readonly EntryObject[]) => void)): void;
        (hostname: string, options: LookupOptions, callback: ((error: null | ErrnoException, address: string, family: IPFamily) => void)): void;
    }
  • Returns undefined | {
        (hostname: string, family: IPFamily, callback: ((error: null | ErrnoException, address: string, family: IPFamily) => void)): void;
        (hostname: string, callback: ((error: null | ErrnoException, address: string, family: IPFamily) => void)): void;
        (hostname: string, options: LookupOptions & {
            all: true;
        }, callback: ((error: null | ErrnoException, result: readonly EntryObject[]) => void)): void;
        (hostname: string, options: LookupOptions, callback: ((error: null | ErrnoException, address: string, family: IPFamily) => void)): void;
    }

  • set dnsLookup(value): void
  • Parameters

    Returns void

  • get dnsCache(): undefined | boolean | default
  • An instance of CacheableLookup used for making DNS lookups. Useful when making lots of requests to different public hostnames.

    CacheableLookup uses dns.resolver4(..) and dns.resolver6(...) under the hood and fall backs to dns.lookup(...) when the first two fail, which may lead to additional delay.

    Note: This should stay disabled when making requests to internal hostnames such as localhost, database.local etc.

    Returns undefined | boolean | default

    false
    
  • set dnsCache(value): void
  • Parameters

    • value: undefined | boolean | default

    Returns void

  • get context(): Record<string, unknown>
  • User data. context is shallow merged and enumerable. If it contains non-enumerable properties they will NOT be merged.

    Returns Record<string, unknown>

    import got from 'got';

    const instance = got.extend({
    hooks: {
    beforeRequest: [
    options => {
    if (!options.context || !options.context.token) {
    throw new Error('Token required');
    }

    options.headers.token = options.context.token;
    }
    ]
    }
    });

    const context = {
    token: 'secret'
    };

    const response = await instance('https://httpbin.org/headers', {context});

    // Let's see the headers
    console.log(response.body);
  • set context(value): void
  • Parameters

    • value: Record<string, unknown>

    Returns void

  • get hooks(): Hooks
  • Hooks allow modifications during the request lifecycle. Hook functions may be async and are run serially.

    Returns Hooks

  • set hooks(value): void
  • Parameters

    Returns void

  • get followRedirect(): boolean
  • Defines if redirect responses should be followed automatically.

    Note that if a 303 is sent by the server in response to any request type (POST, DELETE, etc.), Got will automatically request the resource pointed to in the location header via GET. This is in accordance with the spec. You can optionally turn on this behavior also for other redirect codes - see methodRewriting.

    Returns boolean

    true
    
  • set followRedirect(value): void
  • Parameters

    • value: boolean

    Returns void

  • get followRedirects(): unknown
  • Returns unknown

  • set followRedirects(_value): void
  • Parameters

    • _value: unknown

    Returns void

  • get maxRedirects(): number
  • If exceeded, the request will be aborted and a MaxRedirectsError will be thrown.

    Returns number

    10
    
  • set maxRedirects(value): void
  • Parameters

    • value: number

    Returns void

  • get cache():
        | undefined
        | string
        | boolean
        | StorageAdapter
  • A cache adapter instance for storing cached response data.

    Returns
        | undefined
        | string
        | boolean
        | StorageAdapter

    false
    
  • set cache(value): void
  • Parameters

    • value:
          | undefined
          | string
          | boolean
          | StorageAdapter

    Returns void

  • get throwHttpErrors(): boolean
  • Determines if a got.HTTPError is thrown for unsuccessful responses.

    If this is disabled, requests that encounter an error status code will be resolved with the response instead of throwing. This may be useful if you are checking for resource availability and are expecting error responses.

    Returns boolean

    true
    
  • set throwHttpErrors(value): void
  • Parameters

    • value: boolean

    Returns void

  • get username(): string
  • Returns string

  • set username(value): void
  • Parameters

    • value: string

    Returns void

  • get password(): string
  • Returns string

  • set password(value): void
  • Parameters

    • value: string

    Returns void

  • get http2(): boolean
  • If set to true, Got will additionally accept HTTP2 requests.

    It will choose either HTTP/1.1 or HTTP/2 depending on the ALPN protocol.

    Note: This option requires Node.js 15.10.0 or newer as HTTP/2 support on older Node.js versions is very buggy.

    Note: Overriding options.request will disable HTTP2 support.

    Returns boolean

    false
    
    import got from 'got';

    const {headers} = await got('https://nghttp2.org/httpbin/anything', {http2: true});

    console.log(headers.via);
    //=> '2 nghttpx'
  • set http2(value): void
  • Parameters

    • value: boolean

    Returns void

  • get allowGetBody(): boolean
  • Set this to true to allow sending body for the GET method. However, the HTTP/2 specification says that An HTTP GET request includes request header fields and no payload body, therefore when using the HTTP/2 protocol this option will have no effect. This option is only meant to interact with non-compliant servers when you have no other choice.

    Note: The RFC 7231 doesn't specify any particular behavior for the GET method having a payload, therefore it's considered an anti-pattern.

    Returns boolean

    false
    
  • set allowGetBody(value): void
  • Parameters

    • value: boolean

    Returns void

  • get headers(): Headers
  • Request headers.

    Existing headers will be overwritten. Headers set to undefined will be omitted.

    Returns Headers

    {}
    
  • set headers(value): void
  • Parameters

    Returns void

  • get methodRewriting(): boolean
  • Specifies if the HTTP request method should be rewritten as GET on redirects.

    As the specification prefers to rewrite the HTTP method only on 303 responses, this is Got's default behavior. Setting methodRewriting to true will also rewrite 301 and 302 responses, as allowed by the spec. This is the behavior followed by curl and browsers.

    Note: Got never performs method rewriting on 307 and 308 responses, as this is explicitly prohibited by the specification.

    Returns boolean

    false
    
  • set methodRewriting(value): void
  • Parameters

    • value: boolean

    Returns void

  • get dnsLookupIpVersion(): DnsLookupIpVersion
  • Indicates which DNS record family to use.

    Values:

    • undefined: IPv4 (if present) or IPv6
    • 4: Only IPv4
    • 6: Only IPv6

    Returns DnsLookupIpVersion

    undefined
    
  • set dnsLookupIpVersion(value): void
  • Parameters

    Returns void

  • get parseJson(): ParseJsonFunction
  • A function used to parse JSON responses.

    Returns ParseJsonFunction

    import got from 'got';
    import Bourne from '@hapi/bourne';

    const parsed = await got('https://example.com', {
    parseJson: text => Bourne.parse(text)
    }).json();

    console.log(parsed);
  • set parseJson(value): void
  • Parameters

    Returns void

  • get stringifyJson(): StringifyJsonFunction
  • A function used to stringify the body of JSON requests.

    Returns StringifyJsonFunction

    import got from 'got';

    await got.post('https://example.com', {
    stringifyJson: object => JSON.stringify(object, (key, value) => {
    if (key.startsWith('_')) {
    return;
    }

    return value;
    }),
    json: {
    some: 'payload',
    _ignoreMe: 1234
    }
    });
    import got from 'got';

    await got.post('https://example.com', {
    stringifyJson: object => JSON.stringify(object, (key, value) => {
    if (typeof value === 'number') {
    return value.toString();
    }

    return value;
    }),
    json: {
    some: 'payload',
    number: 1
    }
    });
  • set stringifyJson(value): void
  • Parameters

    Returns void

  • get retry(): Partial<RetryOptions>
  • An object representing limit, calculateDelay, methods, statusCodes, maxRetryAfter and errorCodes fields for maximum retry count, retry handler, allowed methods, allowed status codes, maximum Retry-After time and allowed error codes.

    Delays between retries counts with function 1000 * Math.pow(2, retry) + Math.random() * 100, where retry is attempt number (starts from 1).

    The calculateDelay property is a function that receives an object with attemptCount, retryOptions, error and computedValue properties for current retry count, the retry options, error and default computed value. The function must return a delay in milliseconds (or a Promise resolving with it) (0 return value cancels retry).

    By default, it retries only on the specified methods, status codes, and on these network errors:

    • ETIMEDOUT: One of the timeout limits were reached.
    • ECONNRESET: Connection was forcibly closed by a peer.
    • EADDRINUSE: Could not bind to any free port.
    • ECONNREFUSED: Connection was refused by the server.
    • EPIPE: The remote side of the stream being written has been closed.
    • ENOTFOUND: Couldn't resolve the hostname to an IP address.
    • ENETUNREACH: No internet connection.
    • EAI_AGAIN: DNS lookup timed out.

    Note: If maxRetryAfter is set to undefined, it will use options.timeout. Note: If Retry-After header is greater than maxRetryAfter, it will cancel the request.

    Returns Partial<RetryOptions>

  • set retry(value): void
  • Parameters

    Returns void

  • get localAddress(): undefined | string
  • From http.RequestOptions.

    The IP address used to send the request from.

    Returns undefined | string

  • set localAddress(value): void
  • Parameters

    • value: undefined | string

    Returns void

  • get method(): Method
  • The HTTP method used to make the request.

    Returns Method

    'GET'
    
  • set method(value): void
  • Parameters

    Returns void

  • get cacheOptions(): CacheOptions
  • From http-cache-semantics

    Returns CacheOptions

    {}
    
  • set cacheOptions(value): void
  • Parameters

    Returns void

  • get https(): HttpsOptions
  • Options for the advanced HTTPS API.

    Returns HttpsOptions

  • set https(value): void
  • Parameters

    Returns void

  • get encoding(): undefined | BufferEncoding
  • Encoding to be used on setEncoding of the response data.

    To get a Buffer, you need to set responseType to buffer instead. Don't set this option to null.

    Note: This doesn't affect streams! Instead, you need to do got.stream(...).setEncoding(encoding).

    Returns undefined | BufferEncoding

    'utf-8'
    
  • set encoding(value): void
  • Parameters

    Returns void

  • get resolveBodyOnly(): boolean
  • When set to true the promise will return the Response body instead of the Response object.

    Returns boolean

    false
    
  • set resolveBodyOnly(value): void
  • Parameters

    • value: boolean

    Returns void

  • get isStream(): boolean
  • Returns a Stream instead of a Promise. This is equivalent to calling got.stream(url, options?).

    Returns boolean

    false
    
  • set isStream(value): void
  • Parameters

    • value: boolean

    Returns void

  • get responseType(): ResponseType
  • The parsing method.

    The promise also has .text(), .json() and .buffer() methods which return another Got promise for the parsed body.

    It's like setting the options to {responseType: 'json', resolveBodyOnly: true} but without affecting the main Got promise.

    Note: When using streams, this option is ignored.

    Returns ResponseType

    const responsePromise = got(url);
    const bufferPromise = responsePromise.buffer();
    const jsonPromise = responsePromise.json();

    const [response, buffer, json] = Promise.all([responsePromise, bufferPromise, jsonPromise]);
    // `response` is an instance of Got Response
    // `buffer` is an instance of Buffer
    // `json` is an object
    // This
    const body = await got(url).json();

    // is semantically the same as this
    const body = await got(url, {responseType: 'json', resolveBodyOnly: true});
  • set responseType(value): void
  • Parameters

    Returns void

  • get pagination(): PaginationOptions<unknown, unknown>
  • Returns PaginationOptions<unknown, unknown>

  • set pagination(value): void
  • Parameters

    Returns void

  • get auth(): unknown
  • Returns unknown

  • set auth(_value): void
  • Parameters

    • _value: unknown

    Returns void

  • get setHost(): boolean
  • Returns boolean

  • set setHost(value): void
  • Parameters

    • value: boolean

    Returns void

  • get maxHeaderSize(): undefined | number
  • Returns undefined | number

  • set maxHeaderSize(value): void
  • Parameters

    • value: undefined | number

    Returns void

  • get enableUnixSockets(): boolean
  • Returns boolean

  • set enableUnixSockets(value): void
  • Parameters

    • value: boolean

    Returns void

Methods

  • Parameters

    Returns void

  • Returns {
        ALPNProtocols: undefined | string[];
        ca:
            | undefined
            | string
            | Buffer
            | (string | Buffer)[];
        cert:
            | undefined
            | string
            | Buffer
            | (string | Buffer)[];
        key:
            | undefined
            | string
            | Buffer
            | (string | Buffer | KeyObject)[];
        passphrase: undefined | string;
        pfx: PfxType;
        rejectUnauthorized: undefined | boolean;
        checkServerIdentity: ((hostname: string, cert: PeerCertificate) => Error | undefined) | CheckServerIdentityFunction;
        ciphers: undefined | string;
        honorCipherOrder: undefined | boolean;
        minVersion: undefined | SecureVersion;
        maxVersion: undefined | SecureVersion;
        sigalgs: undefined | string;
        sessionTimeout: undefined | number;
        dhparam: undefined | string | Buffer;
        ecdhCurve: undefined | string;
        crl:
            | undefined
            | string
            | Buffer
            | (string | Buffer)[];
        lookup: undefined | {
            (hostname: string, family: IPFamily, callback: ((error: null | ErrnoException, address: string, family: IPFamily) => void)): void;
            (hostname: string, callback: ((error: null | ErrnoException, address: string, family: IPFamily) => void)): void;
            (hostname: string, options: LookupOptions & {
                all: true;
            }, callback: ((error: null | ErrnoException, result: readonly EntryObject[]) => void)): void;
            (hostname: string, options: LookupOptions, callback: ((error: null | ErrnoException, address: string, family: IPFamily) => void)): void;
        };
        family: DnsLookupIpVersion;
        agent:
            | undefined
            | false
            | Agent
            | Agents;
        setHost: boolean;
        method: Method;
        maxHeaderSize: undefined | number;
        localAddress: undefined | string;
        headers: Headers;
        createConnection: undefined | CreateConnectionFunction;
        timeout: undefined | number;
        h2session: undefined | ClientHttp2Session;
        _defaultAgent?: Agent;
        auth?: null | string;
        defaultPort?: string | number;
        hints?: number;
        host?: null | string;
        hostname?: null | string;
        insecureHTTPParser?: boolean;
        localPort?: number;
        path?: null | string;
        port?: null | string | number;
        protocol?: null | string;
        signal?: AbortSignal;
        socketPath?: string;
        uniqueHeaders?: (string | string[])[];
        joinDuplicateHeaders?: boolean;
        clientCertEngine?: string;
        privateKeyEngine?: string;
        privateKeyIdentifier?: string;
        secureOptions?: number;
        secureProtocol?: string;
        sessionIdContext?: string;
        ticketKeys?: Buffer;
        servername?: string;
        shared?: boolean;
        cacheHeuristic?: number;
        immutableMinTimeToLive?: number;
        ignoreCargoCult?: boolean;
    }

    • ALPNProtocols: undefined | string[]
    • ca:
          | undefined
          | string
          | Buffer
          | (string | Buffer)[]
    • cert:
          | undefined
          | string
          | Buffer
          | (string | Buffer)[]
    • key:
          | undefined
          | string
          | Buffer
          | (string | Buffer | KeyObject)[]
    • passphrase: undefined | string
    • pfx: PfxType
    • rejectUnauthorized: undefined | boolean
    • checkServerIdentity: ((hostname: string, cert: PeerCertificate) => Error | undefined) | CheckServerIdentityFunction
    • ciphers: undefined | string
    • honorCipherOrder: undefined | boolean
    • minVersion: undefined | SecureVersion
    • maxVersion: undefined | SecureVersion
    • sigalgs: undefined | string
    • sessionTimeout: undefined | number
    • dhparam: undefined | string | Buffer
    • ecdhCurve: undefined | string
    • crl:
          | undefined
          | string
          | Buffer
          | (string | Buffer)[]
    • lookup: undefined | {
          (hostname: string, family: IPFamily, callback: ((error: null | ErrnoException, address: string, family: IPFamily) => void)): void;
          (hostname: string, callback: ((error: null | ErrnoException, address: string, family: IPFamily) => void)): void;
          (hostname: string, options: LookupOptions & {
              all: true;
          }, callback: ((error: null | ErrnoException, result: readonly EntryObject[]) => void)): void;
          (hostname: string, options: LookupOptions, callback: ((error: null | ErrnoException, address: string, family: IPFamily) => void)): void;
      }
    • family: DnsLookupIpVersion
    • agent:
          | undefined
          | false
          | Agent
          | Agents
    • setHost: boolean
    • method: Method
    • maxHeaderSize: undefined | number
    • localAddress: undefined | string
    • headers: Headers
    • createConnection: undefined | CreateConnectionFunction
    • timeout: undefined | number
    • h2session: undefined | ClientHttp2Session
    • Optional_defaultAgent?: Agent
    • Optionalauth?: null | string
    • OptionaldefaultPort?: string | number
    • Optionalhints?: number
    • Optionalhost?: null | string
    • Optionalhostname?: null | string
    • OptionalinsecureHTTPParser?: boolean
    • OptionallocalPort?: number
    • Optionalpath?: null | string
    • Optionalport?: null | string | number
    • Optionalprotocol?: null | string
    • Optionalsignal?: AbortSignal
    • OptionalsocketPath?: string
    • OptionaluniqueHeaders?: (string | string[])[]
    • OptionaljoinDuplicateHeaders?: boolean
    • OptionalclientCertEngine?: string
    • OptionalprivateKeyEngine?: string
    • OptionalprivateKeyIdentifier?: string
    • OptionalsecureOptions?: number
    • OptionalsecureProtocol?: string
    • OptionalsessionIdContext?: string
    • OptionalticketKeys?: Buffer
    • Optionalservername?: string
    • Optionalshared?: boolean
    • OptionalcacheHeuristic?: number
    • OptionalimmutableMinTimeToLive?: number
    • OptionalignoreCargoCult?: boolean
  • Returns void