import { checkServerIdentity, type SecureContextOptions, type DetailedPeerCertificate } from 'node:tls';
import https, { type RequestOptions as HttpsRequestOptions, type Agent as HttpsAgent } from 'node:https';
import http, { type Agent as HttpAgent, type ClientRequest } from 'node:http';
import type { Readable } from 'node:stream';
import type { Socket, LookupFunction } from 'node:net';
import CacheableLookup from 'cacheable-lookup';
import http2wrapper, { type ClientHttp2Session } from 'http2-wrapper';
import type { KeyvStoreAdapter } from 'keyv';
import type KeyvType from 'keyv';
import type ResponseLike from 'responselike';
import type { RequestPromise } from '../as-promise/types.js';
import type { IncomingMessageWithTimings } from './utils/timer.js';
import type { PlainResponse, Response } from './response.js';
import type { RequestError } from './errors.js';
import type { Delays } from './timed-out.js';
type StorageAdapter = KeyvStoreAdapter | KeyvType | Map<unknown, unknown>;
type Promisable<T> = T | Promise<T>;
export type DnsLookupIpVersion = undefined | 4 | 6;
type Except<ObjectType, KeysType extends keyof ObjectType> = Pick<ObjectType, Exclude<keyof ObjectType, KeysType>>;
export type NativeRequestOptions = HttpsRequestOptions & CacheOptions & {
    checkServerIdentity?: CheckServerIdentityFunction;
};
type AcceptableResponse = IncomingMessageWithTimings | ResponseLike;
type AcceptableRequestResult = Promisable<AcceptableResponse | ClientRequest | undefined>;
export type RequestFunction = (url: URL, options: NativeRequestOptions, callback?: (response: AcceptableResponse) => void) => AcceptableRequestResult;
export type Agents = {
    http?: HttpAgent | false;
    https?: HttpsAgent | false;
    http2?: unknown | false;
};
export type Headers = Record<string, string | string[] | undefined>;
export type CrossOriginState = {
    headers: Headers;
    hadCookieJar: boolean;
    cookieWasExplicitlySet: boolean;
    username: string;
    password: string;
    body: unknown;
    json: unknown;
    form: unknown;
    bodySnapshot: unknown;
    jsonSnapshot: unknown;
    formSnapshot: unknown;
};
export type ToughCookieJar = {
    getCookieString: ((currentUrl: string, options: Record<string, unknown>, callback: (error: Error | undefined, cookies: string) => void) => void) & ((url: string, callback: (error: Error | undefined, cookieHeader: string) => void) => void);
    setCookie: ((cookieOrString: unknown, currentUrl: string, options: Record<string, unknown>, callback: (error: Error | undefined, cookie: unknown) => void) => void) & ((rawCookie: string, url: string, callback: (error: Error | undefined, result: unknown) => void) => void);
};
export type PromiseCookieJar = {
    getCookieString: (url: string) => Promise<string>;
    setCookie: (rawCookie: string, url: string) => Promise<unknown>;
};
/**
Utility type to override specific properties in a type.

Uses `Omit` to remove properties before adding them back to ensure proper type replacement rather than intersection, which handles edge cases with optional/required properties correctly.
*/
type OverrideProperties<T, U> = Omit<T, keyof U> & U;
/**
Represents the runtime state of Options as seen by hooks after normalization.

Some Options properties accept multiple input types but are normalized to a single type internally by the Options class setters. This type reflects the actual runtime types that hooks receive, ensuring type safety when accessing options within hook functions.
*/
export type NormalizedOptions = OverrideProperties<Options, {
    url: URL | undefined;
    dnsCache: CacheableLookup | undefined;
    cache: StorageAdapter | undefined;
    prefixUrl: string;
}>;
export type InitHook = (init: OptionsInit, self: Options) => void;
export type BeforeRequestHookContext = {
    /**
    The current retry count.

    It will be `0` for the initial request and increment for each retry.
    */
    retryCount: number;
};
export type BeforeRequestHook = (options: NormalizedOptions, context: BeforeRequestHookContext) => Promisable<void | Response | ResponseLike>;
export type BeforeRedirectHook = (updatedOptions: NormalizedOptions, plainResponse: PlainResponse) => Promisable<void>;
export type BeforeErrorHook = (error: RequestError) => Promisable<Error>;
export type BeforeRetryHook = (error: RequestError, retryCount: number) => Promisable<void>;
export type BeforeCacheHook = (response: PlainResponse) => false | void;
export type AfterResponseHook<ResponseType = unknown> = (response: Response<ResponseType>, retryWithMergedOptions: (options: OptionsInit) => never) => Promisable<Response | RequestPromise<Response>>;
/**
All available hooks of Got.
*/
export type Hooks = {
    /**
    Called with the plain request options, right before their normalization.

    The second argument represents the current `Options` instance.

    @default []

    Note:
    > - This hook must be synchronous.

    Note:
    > - This is called every time options are merged.

    Note:
    > - The `options` object may not have the `url` property. To modify it, use a `beforeRequest` hook instead.

    Note:
    > - This hook is called when a new instance of `Options` is created.
    > - Do not confuse this with the creation of `Request` or `got(…)`.

    Note:
    > - When using `got(url)` or `got(url, undefined, defaults)` this hook will **not** be called.

    This is especially useful in conjunction with `got.extend()` when the input needs custom handling.

    For example, this can be used to fix typos to migrate from older versions faster.

    @example
    ```
    import got from 'got';

    const instance = got.extend({
        hooks: {
            init: [
                plain => {
                    if ('followRedirects' in plain) {
                        plain.followRedirect = plain.followRedirects;
                        delete plain.followRedirects;
                    }
                }
            ]
        }
    });

    // Normally, the following would throw:
    const response = await instance(
        'https://example.com',
        {
            followRedirects: true
        }
    );

    // There is no option named `followRedirects`, but we correct it in an `init` hook.
    ```

    Or you can create your own option and store it in a context:

    ```
    import got from 'got';

    const instance = got.extend({
        hooks: {
            init: [
                (plain, options) => {
                    if ('secret' in plain) {
                        options.context.secret = plain.secret;
                        delete plain.secret;
                    }
                }
            ],
            beforeRequest: [
                options => {
                    options.headers.secret = options.context.secret;
                }
            ]
        }
    });

    const {headers} = await instance(
        'https://httpbin.org/anything',
        {
            secret: 'passphrase'
        }
    ).json();

    console.log(headers.Secret);
    //=> 'passphrase'
    ```
    */
    init: InitHook[];
    /**
    Called right before making the request with `options.createNativeRequestOptions()`.

    The second argument is a context object containing request state information.

    This hook is especially useful in conjunction with `got.extend()` when you want to sign your request.

    @default []

    Note:
    > - Got will make no further changes to the request before it is sent.

    Note:
    > - Changing `options.json` or `options.form` has no effect on the request. You should change `options.body` instead. If needed, update the `options.headers` accordingly.

    @example
    ```
    import got from 'got';

    const response = await got.post(
        'https://httpbin.org/anything',
        {
            json: {payload: 'old'},
            hooks: {
                beforeRequest: [
                    (options, context) => {
                        options.body = JSON.stringify({payload: 'new'});
                        options.headers['content-length'] = options.body.length.toString();
                    }
                ]
            }
        }
    );
    ```

    Example using `context.retryCount`:

    ```
    import got from 'got';

    await got('https://httpbin.org/status/500', {
        retry: {
            limit: 2
        },
        hooks: {
            beforeRequest: [
                (options, context) => {
                    // Only log on the initial request, not on retries
                    if (context.retryCount === 0) {
                        console.log('Making initial request');
                    }
                }
            ]
        }
    });
    ```

    Tip:
    > - You can indirectly override the `request` function by early returning a [`ClientRequest`-like](https://nodejs.org/api/http.html#http_class_http_clientrequest) instance or a [`IncomingMessage`-like](https://nodejs.org/api/http.html#http_class_http_incomingmessage) instance. This is very useful when creating a custom cache mechanism.
    > - [Read more about this tip](https://github.com/sindresorhus/got/blob/main/documentation/cache.md#advanced-caching-mechanisms).
    */
    beforeRequest: BeforeRequestHook[];
    /**
    The equivalent of `beforeRequest` but when redirecting.

    @default []

    Tip:
    > - This is especially useful when you want to avoid dead sites.

    @example
    ```
    import got from 'got';

    const response = await got('https://example.com', {
        hooks: {
            beforeRedirect: [
                (options, response) => {
                    if (options.hostname === 'deadSite') {
                        options.hostname = 'fallbackSite';
                    }
                }
            ]
        }
    });
    ```
    */
    beforeRedirect: BeforeRedirectHook[];
    /**
    Called with a `RequestError` instance. The error is passed to the hook right before it's thrown.

    This hook can return any `Error` instance, allowing you to:
    - Return custom error classes for better error handling in your application
    - Extend `RequestError` with additional properties
    - Return plain `Error` instances when you don't need Got-specific error information

    This is especially useful when you want to have more detailed errors or maintain backward compatibility with existing error handling code.

    @default []

    @example
    ```
    import got from 'got';

    // Modify and return the error
    await got('https://api.github.com/repos/sindresorhus/got/commits', {
        responseType: 'json',
        hooks: {
            beforeError: [
                error => {
                    const {response} = error;
                    if (response && response.body) {
                        error.name = 'GitHubError';
                        error.message = `${response.body.message} (${response.statusCode})`;
                    }

                    return error;
                }
            ]
        }
    });

    // Return a custom error class
    class CustomAPIError extends Error {
        constructor(message, statusCode) {
            super(message);
            this.name = 'CustomAPIError';
            this.statusCode = statusCode;
        }
    }

    await got('https://api.example.com/endpoint', {
        hooks: {
            beforeError: [
                error => {
                    // Return a custom error for backward compatibility with your application
                    return new CustomAPIError(
                        error.message,
                        error.response?.statusCode
                    );
                }
            ]
        }
    });
    ```
    */
    beforeError: BeforeErrorHook[];
    /**
    The equivalent of `beforeError` but when retrying. Additionally, there is a second argument `retryCount`, the current retry number.

    @default []

    Note:
    > - When using the Stream API, this hook is ignored.

    Note:
    > - When retrying, the `beforeRequest` hook is called afterwards.

    Note:
    > - If no retry occurs, the `beforeError` hook is called instead.

    This hook is especially useful when you want to retrieve the cause of a retry.

    @example
    ```
    import got from 'got';

    await got('https://httpbin.org/status/500', {
        hooks: {
            beforeRetry: [
                (error, retryCount) => {
                    console.log(`Retrying [${retryCount}]: ${error.code}`);
                    // Retrying [1]: ERR_NON_2XX_3XX_RESPONSE
                }
            ]
        }
    });
    ```
    */
    beforeRetry: BeforeRetryHook[];
    /**
    Called right before the response is cached. Allows you to control caching behavior by directly modifying the response or preventing caching.

    This is especially useful when you want to prevent caching of specific responses or modify cache headers.

    @default []

    Return value:
    > - `false` - Prevent caching (remaining hooks are skipped)
    > - `void`/`undefined` - Use default caching behavior (mutations take effect)

    Modifying the response:
    > - Hooks can directly mutate response properties like `headers`, `statusCode`, and `statusMessage`
    > - Mutations to `response.headers` affect how the caching layer decides whether to cache the response and for how long
    > - Changes are applied to what gets cached

    Note:
    > - This hook is only called when the `cache` option is enabled.

    Note:
    > - This hook must be synchronous. It cannot return a Promise. If you need async logic to determine caching behavior, use a `beforeRequest` hook instead.

    Note:
    > - When returning `false`, remaining hooks are skipped and the response will not be cached.

    Note:
    > - Returning anything other than `false` or `undefined` will throw a TypeError.

    Note:
    > - If a hook throws an error, it will be propagated and the request will fail. This is consistent with how other hooks in Got handle errors.

    Note:
    > - At this stage, the response body has not been read yet - it's still a stream. Properties like `response.body` and `response.rawBody` are not available. You can only inspect/modify response headers and status code.

    @example
    ```
    import got from 'got';

    // Simple: Don't cache errors
    const instance = got.extend({
        cache: new Map(),
        hooks: {
            beforeCache: [
                (response) => response.statusCode >= 400 ? false : undefined
            ]
        }
    });

    // Advanced: Modify headers for fine control
    const instance2 = got.extend({
        cache: new Map(),
        hooks: {
            beforeCache: [
                (response) => {
                    // Force caching with explicit duration
                    // Mutations work directly - no need to return
                    response.headers['cache-control'] = 'public, max-age=3600';
                }
            ]
        }
    });

    await instance('https://example.com');
    ```
    */
    beforeCache: BeforeCacheHook[];
    /**
    Each function should return the response. This is especially useful when you want to refresh an access token.

    @default []

    Note:
    > - When using the Stream API, this hook is ignored.

    Note:
    > - Calling the `retryWithMergedOptions` function will trigger `beforeRetry` hooks. By default, remaining `afterResponse` hooks are removed to prevent duplicate execution. To preserve remaining hooks on retry, set `preserveHooks: true` in the options passed to `retryWithMergedOptions`. In case of an error, `beforeRetry` hooks will be called instead.
    Meanwhile the `init`, `beforeRequest` , `beforeRedirect` as well as already executed `afterResponse` hooks will be skipped.

    Note:
    > - To preserve remaining `afterResponse` hooks after calling `retryWithMergedOptions`, set `preserveHooks: true` in the options passed to `retryWithMergedOptions`. This is useful when you want hooks to run on retried requests.

    Warning:
    > - Be cautious when using `preserveHooks: true`. If a hook unconditionally calls `retryWithMergedOptions` with `preserveHooks: true`, it will create an infinite retry loop. Always ensure hooks have proper conditional logic to avoid infinite retries.

    @example
    ```
    import got from 'got';

    const instance = got.extend({
        hooks: {
            afterResponse: [
                (response, retryWithMergedOptions) => {
                    // Unauthorized
                    if (response.statusCode === 401) {
                        // Refresh the access token
                        const updatedOptions = {
                            headers: {
                                token: getNewToken()
                            }
                        };

                        // Update the defaults
                        instance.defaults.options.merge(updatedOptions);

                        // Make a new retry
                        return retryWithMergedOptions(updatedOptions);
                    }

                    // No changes otherwise
                    return response;
                }
            ],
            beforeRetry: [
                error => {
                    // This will be called on `retryWithMergedOptions(...)`
                }
            ]
        },
        mutableDefaults: true
    });
    ```

    @example
    ```
    // Example with preserveHooks
    import got from 'got';

    const instance = got.extend({
        hooks: {
            afterResponse: [
                (response, retryWithMergedOptions) => {
                    if (response.statusCode === 401) {
                        return retryWithMergedOptions({
                            headers: {
                                authorization: getNewToken()
                            },
                            preserveHooks: true  // Keep remaining hooks
                        });
                    }

                    return response;
                },
                (response) => {
                    // This hook will run on the retried request
                    // (the original request is interrupted when the first hook triggers a retry)
                    console.log('Response received:', response.statusCode);
                    return response;
                }
            ]
        }
    });
    ```
    */
    afterResponse: AfterResponseHook[];
};
export type ParseJsonFunction = (text: string) => unknown;
export type StringifyJsonFunction = (object: unknown) => string;
/**
All available HTTP request methods provided by Got.
*/
export type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'HEAD' | 'DELETE' | 'OPTIONS' | 'TRACE' | 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete' | 'options' | 'trace';
export type RetryObject = {
    attemptCount: number;
    retryOptions: RetryOptions;
    error: RequestError;
    computedValue: number;
    retryAfter?: number;
};
export type RetryFunction = (retryObject: RetryObject) => Promisable<number>;
/**
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`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/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).

The `enforceRetryRules` property is a `boolean` that, when set to `true` (default), enforces the `limit`, `methods`, `statusCodes`, and `errorCodes` options before calling `calculateDelay`. Your `calculateDelay` function is only invoked when a retry is allowed based on these criteria. When `false`, `calculateDelay` receives the computed value but can override all retry logic.

__Note:__ When `enforceRetryRules` is `false`, you must check `computedValue` in your `calculateDelay` function to respect retry rules. When `true` (default), the retry rules are enforced automatically.

By default, it retries *only* on the specified methods, status codes, and on these network errors:
- `ETIMEDOUT`: One of the [timeout](#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:__ Got does not retry on `POST` by default.
__Note:__ If `maxRetryAfter` is set to `undefined`, it will use `options.timeout`.
__Note:__ If [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header is greater than `maxRetryAfter`, it will cancel the request.
*/
export type RetryOptions = {
    limit: number;
    methods: Method[];
    statusCodes: number[];
    errorCodes: string[];
    calculateDelay: RetryFunction;
    backoffLimit: number;
    noise: number;
    maxRetryAfter?: number;
    enforceRetryRules?: boolean;
};
export type CreateConnectionFunction = (options: NativeRequestOptions, oncreate: (error: NodeJS.ErrnoException, socket: Socket) => void) => Socket;
export type CheckServerIdentityFunction = (hostname: string, certificate: DetailedPeerCertificate) => NodeJS.ErrnoException | void;
export type CacheOptions = {
    shared?: boolean;
    cacheHeuristic?: number;
    immutableMinTimeToLive?: number;
    ignoreCargoCult?: boolean;
};
type PfxObject = {
    buffer: string | Uint8Array;
    passphrase?: string | undefined;
};
type PfxType = string | Uint8Array | Array<string | Uint8Array | PfxObject> | undefined;
export type HttpsOptions = {
    alpnProtocols?: string[];
    rejectUnauthorized?: NativeRequestOptions['rejectUnauthorized'];
    checkServerIdentity?: CheckServerIdentityFunction;
    /**
    Server name for the [Server Name Indication (SNI)](https://en.wikipedia.org/wiki/Server_Name_Indication) TLS extension.

    This is useful when requesting to servers that don't have a proper domain name but use a certificate with a known CN/SAN.

    @example
    ```
    import got from 'got';

    // Request to IP address with specific servername for TLS
    await got('https://192.168.1.100', {
        https: {
            serverName: 'example.com'
        }
    });
    ```
    */
    serverName?: string;
    /**
    Override the default Certificate Authorities ([from Mozilla](https://ccadb-public.secure.force.com/mozilla/IncludedCACertificateReport)).

    @example
    ```
    // Single Certificate Authority
    await got('https://example.com', {
        https: {
            certificateAuthority: fs.readFileSync('./my_ca.pem')
        }
    });
    ```
    */
    certificateAuthority?: SecureContextOptions['ca'];
    /**
    Private keys in [PEM](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) format.

    [PEM](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) allows the option of private keys being encrypted.
    Encrypted keys will be decrypted with `options.https.passphrase`.

    Multiple keys with different passphrases can be provided as an array of `{pem: <string | Uint8Array>, passphrase: <string>}`
    */
    key?: SecureContextOptions['key'];
    /**
    [Certificate chains](https://en.wikipedia.org/wiki/X.509#Certificate_chains_and_cross-certification) in [PEM](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) format.

    One cert chain should be provided per private key (`options.https.key`).

    When providing multiple cert chains, they do not have to be in the same order as their private keys in `options.https.key`.

    If the intermediate certificates are not provided, the peer will not be able to validate the certificate, and the handshake will fail.
    */
    certificate?: SecureContextOptions['cert'];
    /**
    The passphrase to decrypt the `options.https.key` (if different keys have different passphrases refer to `options.https.key` documentation).
    */
    passphrase?: SecureContextOptions['passphrase'];
    pfx?: PfxType;
    ciphers?: SecureContextOptions['ciphers'];
    honorCipherOrder?: SecureContextOptions['honorCipherOrder'];
    minVersion?: SecureContextOptions['minVersion'];
    maxVersion?: SecureContextOptions['maxVersion'];
    signatureAlgorithms?: SecureContextOptions['sigalgs'];
    tlsSessionLifetime?: SecureContextOptions['sessionTimeout'];
    dhparam?: SecureContextOptions['dhparam'];
    ecdhCurve?: SecureContextOptions['ecdhCurve'];
    certificateRevocationLists?: SecureContextOptions['crl'];
    /**
    Optionally affect the OpenSSL protocol behavior, which is not usually necessary. This should be used carefully if at all!

    The value is a numeric bitmask of the `SSL_OP_*` options from OpenSSL.

    For example, to allow connections to legacy servers that do not support secure renegotiation, you can use `crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT`.

    @example
    ```
    import crypto from 'node:crypto';
    import got from 'got';

    // Allow connections to servers with legacy renegotiation
    await got('https://legacy-server.com', {
        https: {
            secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT
        }
    });
    ```
    */
    secureOptions?: number;
};
export type PaginateData<BodyType, ElementType> = {
    response: Response<BodyType>;
    currentItems: ElementType[];
    allItems: ElementType[];
};
export type FilterData<ElementType> = {
    item: ElementType;
    currentItems: ElementType[];
    allItems: ElementType[];
};
/**
All options accepted by `got.paginate()`.
*/
export type PaginationOptions<ElementType, BodyType> = {
    /**
    A function that transform [`Response`](#response) into an array of items.
    This is where you should do the parsing.

    @default response => JSON.parse(response.body)
    */
    transform?: (response: Response<BodyType>) => Promise<ElementType[]> | ElementType[];
    /**
    Checks whether the item should be emitted or not.

    @default ({item, currentItems, allItems}) => true
    */
    filter?: (data: FilterData<ElementType>) => boolean;
    /**
    The function takes an object with the following properties:
    - `response` - The current response object.
    - `currentItems` - Items from the current response.
    - `allItems` - An empty array, unless `pagination.stackAllItems` is set to `true`, in which case, it's an array of the emitted items.

    It should return an object representing Got options pointing to the next page. The options are merged automatically with the previous request, therefore the options returned `pagination.paginate(...)` must reflect changes only. The returned `url` can be a string or URL instance. Relative string URLs resolve against the current request URL, which after a cross-origin redirect is the final redirected URL rather than the original `prefixUrl`. If there are no more pages, `false` should be returned.

    When pagination navigates to a different origin, Got strips inherited sensitive headers such as `authorization`, `cookie`, and `proxy-authorization`. If you trust the next-page URL and want to forward a sensitive header, return it explicitly from `pagination.paginate(...)`.

    @example
    ```
    import got from 'got';

    const limit = 10;

    const items = got.paginate('https://example.com/items', {
        searchParams: {
            limit,
            offset: 0
        },
        pagination: {
            paginate: ({response, currentItems}) => {
                const previousSearchParams = response.request.options.searchParams;
                const previousOffset = previousSearchParams.get('offset');

                if (currentItems.length < limit) {
                    return false;
                }

                return {
                    searchParams: {
                        ...previousSearchParams,
                        offset: Number(previousOffset) + limit,
                    }
                };
            }
        }
    });

    console.log('Items from all pages:', items);
    ```
    */
    paginate?: (data: PaginateData<BodyType, ElementType>) => OptionsInit | false;
    /**
    Checks whether the pagination should continue.

    For example, if you need to stop **before** emitting an entry with some flag, you should use `({item}) => !item.flag`.

    If you want to stop **after** emitting the entry, you should use
    `({item, allItems}) => allItems.some(item => item.flag)` instead.

    @default ({item, currentItems, allItems}) => true
    */
    shouldContinue?: (data: FilterData<ElementType>) => boolean;
    /**
    The maximum amount of items that should be emitted.

    @default Infinity
    */
    countLimit?: number;
    /**
    Milliseconds to wait before the next request is triggered.

    @default 0
    */
    backoff?: number;
    /**
    The maximum amount of request that should be triggered.
    Retries on failure are not counted towards this limit.

    For example, it can be helpful during development to avoid an infinite number of requests.

    @default 10000
    */
    requestLimit?: number;
    /**
    Defines how the property `allItems` in `pagination.paginate`, `pagination.filter` and `pagination.shouldContinue` is managed.

    By default, the property `allItems` is always an empty array. This setting can be helpful to save on memory usage when working with a large dataset.

    When set to `true`, the property `allItems` is an array of the emitted items.

    @default false
    */
    stackAllItems?: boolean;
};
export type SearchParameters = Record<string, string | number | boolean | undefined>;
export declare function isSameOrigin(previousUrl: URL, nextUrl: URL): boolean;
export declare const crossOriginStripHeaders: readonly ["host", "cookie", "cookie2", "authorization", "proxy-authorization"];
export declare const hasExplicitCredentialInUrlChange: (changedState: Set<string>, url: URL | undefined, credential: "username" | "password") => boolean;
export declare const assertUrlHasSameOriginAsPrefixUrlIfNeeded: (options: Options, url: URL) => void;
export type UrlPrefixBoundary = {
    url?: URL;
    prefixUrl?: string;
    allowAbsoluteUrls?: boolean;
};
export declare const getUrlPrefixBoundary: (options: Options) => UrlPrefixBoundary;
export declare const hasUrlOrPrefixUrlBoundaryChanged: (options: Options, currentUrl: URL, previous: UrlPrefixBoundary) => boolean;
export declare function applyUrlOverride(options: Options, url: string | URL, { username, password, baseUrl }?: {
    username?: string;
    password?: string;
    baseUrl?: URL;
}): URL;
/**
All parsing methods supported by Got.
*/
export type ResponseType = 'json' | 'buffer' | 'text';
type OptionsToSkip = 'searchParameters' | 'followRedirects' | 'auth' | 'toJSON' | 'merge' | 'isHeaderExplicitlySet' | 'shouldCopyPipedHeader' | 'setPipedHeader' | 'getInternalHeaders' | 'setInternalHeader' | 'deleteInternalHeader' | 'trackStateMutations' | 'clearBody' | 'clearUnchangedCookieHeader' | 'restoreCookieHeader' | 'syncCookieHeaderAfterMerge' | 'stripUnchangedCrossOriginState' | 'stripSensitiveHeaders' | 'createNativeRequestOptions' | 'getRequestFunction' | 'freeze';
export type InternalsType = Except<Options, OptionsToSkip>;
export type OptionsError = NodeJS.ErrnoException & {
    options?: Options;
};
export type OptionsInit = Except<Partial<InternalsType>, 'hooks' | 'retry' | 'isStream'> & {
    hooks?: Partial<Hooks>;
    retry?: Partial<RetryOptions>;
    preserveHooks?: boolean;
};
export default class Options {
    #private;
    constructor(input?: string | URL | OptionsInit, options?: OptionsInit, defaults?: Options);
    merge(options?: OptionsInit | Options): void;
    /**
    Custom request function.
    The main purpose of this is to [support HTTP2 using a wrapper](https://github.com/szmarczak/http2-wrapper).

    @default http.request | https.request
    */
    get request(): RequestFunction | undefined;
    set request(value: RequestFunction | undefined);
    /**
    An object representing `http`, `https` and `http2` keys for [`http.Agent`](https://nodejs.org/api/http.html#http_class_http_agent), [`https.Agent`](https://nodejs.org/api/https.html#https_class_https_agent) and [`http2wrapper.Agent`](https://github.com/szmarczak/http2-wrapper#new-http2agentoptions) 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.

    @example
    ```
    import got from 'got';
    import HttpAgent from 'agentkeepalive';

    const {HttpsAgent} = HttpAgent;

    await got('https://sindresorhus.com', {
        agent: {
            http: new HttpAgent(),
            https: new HttpsAgent()
        }
    });
    ```
    */
    get agent(): Agents;
    set agent(value: Agents);
    get h2session(): ClientHttp2Session | undefined;
    set h2session(value: ClientHttp2Session | undefined);
    /**
    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 `Uint8Array`.
    This may be useful if you want to handle decompression yourself or stream the raw compressed data.

    @default true
    */
    get decompress(): boolean;
    set decompress(value: boolean);
    /**
    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](https://nodejs.org/api/http.html#http_request_settimeout_timeout_callback).
    - `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.
    */
    get timeout(): Delays;
    set timeout(value: Delays);
    /**
    When specified, `prefixUrl` will be prepended to relative string `url` input.
    The prefix can be any valid URL, either relative or absolute.
    A trailing slash `/` is optional - one will be added automatically.

    __Note__: Absolute string URLs and URL instances bypass `prefixUrl` by default. Other instance defaults, including headers, still apply. For untrusted URLs, set `allowAbsoluteUrls` to `false`.

    __Note__: Got cannot know which custom headers are sensitive. If you use headers like `x-api-key`, only pass trusted URLs or use `allowAbsoluteUrls: false`.

    __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.

    @example
    ```
    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'
    ```
    */
    get prefixUrl(): string | URL;
    set prefixUrl(value: string | URL);
    /**
    __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` / `Uint8Array` / typed array, 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`.

    You can use `Iterable` and `AsyncIterable` objects as request body, including Web [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream):

    @example
    ```
    import got from 'got';

    // Using an async generator
    async function* generateData() {
        yield 'Hello, ';
        yield 'world!';
    }

    await got.post('https://httpbin.org/anything', {
        body: generateData()
    });
    ```
    */
    get body(): string | Uint8Array | Readable | Generator | AsyncGenerator | Iterable<unknown> | AsyncIterable<unknown> | FormData | ArrayBufferView | undefined;
    set body(value: string | Uint8Array | Readable | Generator | AsyncGenerator | Iterable<unknown> | AsyncIterable<unknown> | FormData | ArrayBufferView | undefined);
    /**
    The form body is converted to a query string using [`(new URLSearchParams(object)).toString()`](https://nodejs.org/api/url.html#url_constructor_new_urlsearchparams_obj).

    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.
    */
    get form(): Record<string, any> | undefined;
    set form(value: Record<string, any> | undefined);
    /**
    JSON request body. If the `content-type` header is not set, it will be set to `application/json`.

    __Important__: This option only affects the request body you send to the server. To parse the response as JSON, you must either call `.json()` on the promise or set `responseType: 'json'` in the options.

    __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.
    */
    get json(): unknown;
    set json(value: unknown);
    /**
    The URL to request, as a string, a [`https.request` options object](https://nodejs.org/api/https.html#https_https_request_options_callback), or a [WHATWG `URL`](https://nodejs.org/api/url.html#url_class_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.

    @example
    ```
    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
    ```
    */
    get url(): string | URL | undefined;
    set url(value: string | URL | undefined);
    /**
    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.
    */
    get cookieJar(): PromiseCookieJar | ToughCookieJar | undefined;
    set cookieJar(value: PromiseCookieJar | ToughCookieJar | undefined);
    /**
    You can abort the `request` using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).

    @example
    ```
    import got from 'got';

    const abortController = new AbortController();

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

    setTimeout(() => {
        abortController.abort();
    }, 100);
    ```
    */
    get signal(): AbortSignal | undefined;
    set signal(value: AbortSignal | undefined);
    /**
    Ignore invalid cookies instead of throwing an error.
    Only useful when the `cookieJar` option has been set. Not recommended.

    @default false
    */
    get ignoreInvalidCookies(): boolean;
    set ignoreInvalidCookies(value: boolean);
    /**
    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.

    @example
    ```
    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'
    ```
    */
    get searchParams(): string | SearchParameters | URLSearchParams | undefined;
    set searchParams(value: string | SearchParameters | URLSearchParams | undefined);
    get searchParameters(): unknown;
    set searchParameters(_value: unknown);
    get dnsLookup(): LookupFunction | undefined;
    set dnsLookup(value: LookupFunction | undefined);
    /**
    An instance of [`CacheableLookup`](https://github.com/szmarczak/cacheable-lookup) 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.

    @default false
    */
    get dnsCache(): CacheableLookup | boolean | undefined;
    set dnsCache(value: CacheableLookup | boolean | undefined);
    /**
    User data. `context` is shallow merged and enumerable. If it contains non-enumerable properties they will NOT be merged.

    @example
    ```
    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);
    ```
    */
    get context(): Record<string, unknown>;
    set context(value: Record<string, unknown>);
    /**
    Hooks allow modifications during the request lifecycle.
    Hook functions may be async and are run serially.
    */
    get hooks(): Hooks;
    set hooks(value: Hooks);
    /**
    Whether redirect responses should be followed automatically.

    Optionally, pass a function to dynamically decide based on the response object.

    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](https://tools.ietf.org/html/rfc7231#section-6.4.4). You can optionally turn on this behavior also for other redirect codes - see `methodRewriting`.
    On cross-origin redirects, Got strips `host`, `cookie`, `cookie2`, `authorization`, and `proxy-authorization`. When a redirect rewrites the request to `GET`, Got also strips request body headers. Use `hooks.beforeRedirect` for app-specific sensitive headers.

    @default true
    */
    get followRedirect(): boolean | ((response: PlainResponse) => boolean);
    set followRedirect(value: boolean | ((response: PlainResponse) => boolean));
    get followRedirects(): unknown;
    set followRedirects(_value: unknown);
    /**
    If exceeded, the request will be aborted and a `MaxRedirectsError` will be thrown.

    @default 10
    */
    get maxRedirects(): number;
    set maxRedirects(value: number);
    /**
    A cache adapter instance for storing cached response data.

    @default false
    */
    get cache(): string | StorageAdapter | boolean | undefined;
    set cache(value: string | StorageAdapter | boolean | undefined);
    /**
    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.

    @default true
    */
    get throwHttpErrors(): boolean;
    set throwHttpErrors(value: boolean);
    get username(): string;
    set username(value: string);
    get password(): string;
    set password(value: string);
    /**
    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.

    @default false

    @example
    ```
    import got from 'got';

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

    console.log(headers.via);
    //=> '2 nghttpx'
    ```
    */
    get http2(): boolean;
    set http2(value: boolean);
    /**
    Set this to `true` to allow sending body for the `GET` method.
    However, the [HTTP/2 specification](https://tools.ietf.org/html/rfc7540#section-8.1.3) 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](https://tools.ietf.org/html/rfc7231#section-4.3.1) doesn't specify any particular behavior for the GET method having a payload, therefore __it's considered an [anti-pattern](https://en.wikipedia.org/wiki/Anti-pattern)__.

    @default false
    */
    get allowGetBody(): boolean;
    set allowGetBody(value: boolean);
    /**
    Allow absolute URLs to bypass `prefixUrl`.

    When set to `false` with `prefixUrl`, passing an absolute `url` will throw. This also rejects scheme-relative URL strings like `//example.com/path` in retry and pagination URL overrides. Use this when untrusted URL input must stay on the same origin as the configured `prefixUrl`. This is not a path sandbox: relative paths like `../other` still follow standard URL resolution on the same origin. Set `prefixUrl` to an empty string for a request that intentionally needs an absolute URL.

    __Note__: This guards the `url` you pass. It does not block cross-origin redirects issued by the server, though inherited sensitive headers are still stripped when a redirect changes origin.

    __Note__: The check is defeated if the same hook or `pagination.paginate(…)` return also sets `prefixUrl` or `allowAbsoluteUrls`. Do not populate those options from untrusted data.

    @default true
    */
    get allowAbsoluteUrls(): boolean;
    set allowAbsoluteUrls(value: boolean);
    /**
    Automatically copy headers from piped streams.

    When piping a request into a Got stream (e.g., `request.pipe(got.stream(url))`), this controls whether headers from the source stream are automatically merged into the Got request headers.

    Note: Explicitly set headers take precedence over piped headers. Piped headers are only copied when a header is not already explicitly set.

    Useful for proxy scenarios when explicitly enabled, but you may still want to filter out headers like `Host`, `Connection`, `Authorization`, etc.

    @default false

    @example
    ```
    import got from 'got';
    import {pipeline} from 'node:stream/promises';

    // Opt in to automatic header copying for proxy scenarios
    server.get('/proxy', async (request, response) => {
        const gotStream = got.stream('https://example.com', {
            copyPipedHeaders: true,
            // Explicit headers win over piped headers
            headers: {
                host: 'example.com',
            }
        });

        await pipeline(request, gotStream, response);
    });
    ```

    @example
    ```
    import got from 'got';
    import {pipeline} from 'node:stream/promises';

    // Keep it disabled and manually copy only safe headers
    server.get('/proxy', async (request, response) => {
        const gotStream = got.stream('https://example.com', {
            headers: {
                'user-agent': request.headers['user-agent'],
                'accept': request.headers['accept'],
                // Explicitly NOT copying host, connection, authorization, etc.
            }
        });

        await pipeline(request, gotStream, response);
    });
    ```
    */
    get copyPipedHeaders(): boolean;
    set copyPipedHeaders(value: boolean);
    isHeaderExplicitlySet(name: string): boolean;
    shouldCopyPipedHeader(name: string): boolean;
    setPipedHeader(name: string, value: string | string[] | undefined): void;
    getInternalHeaders(): Headers;
    setInternalHeader(name: string, value: string | string[] | undefined): void;
    deleteInternalHeader(name: string): void;
    trackStateMutations<Value>(operation: (changedState: Set<string>) => Promisable<Value>): Promise<Value>;
    clearBody(): void;
    clearUnchangedCookieHeader(previousState: CrossOriginState | undefined, changedState?: Set<string>): void;
    restoreCookieHeader(previousState: CrossOriginState | undefined, headers?: Headers): void;
    syncCookieHeaderAfterMerge(previousState: CrossOriginState | undefined, headers?: Headers): void;
    stripUnchangedCrossOriginState(previousState: CrossOriginState, changedState: Set<string>, { clearBody }?: {
        clearBody?: boolean;
    }): void;
    /**
    Strip sensitive headers and credentials when navigating to a different origin.
    Headers and credentials explicitly provided in `userOptions` are preserved.
    */
    stripSensitiveHeaders(previousUrl: URL, nextUrl: URL, userOptions: OptionsInit): void;
    /**
    Request headers.

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

    @default {}
    */
    get headers(): Headers;
    set headers(value: Headers);
    /**
    Specifies if the HTTP request method should be [rewritten as `GET`](https://tools.ietf.org/html/rfc7231#section-6.4) on redirects.

    As the [specification](https://tools.ietf.org/html/rfc7231#section-6.4) prefers to rewrite the HTTP method only on `303` responses, this is Got's default behavior. Cross-origin `301` and `302` redirects also rewrite `POST` requests to `GET` by default to avoid forwarding request bodies to another origin.
    Setting `methodRewriting` to `true` will also rewrite same-origin `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](https://www.rfc-editor.org/rfc/rfc7231#section-6.4.7).

    @default false
    */
    get methodRewriting(): boolean;
    set methodRewriting(value: boolean);
    /**
    Indicates which DNS record family to use.

    Values:
    - `undefined`: IPv4 (if present) or IPv6
    - `4`: Only IPv4
    - `6`: Only IPv6

    @default undefined
    */
    get dnsLookupIpVersion(): DnsLookupIpVersion;
    set dnsLookupIpVersion(value: DnsLookupIpVersion);
    /**
    A function used to parse JSON responses.

    @example
    ```
    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);
    ```
    */
    get parseJson(): ParseJsonFunction;
    set parseJson(value: ParseJsonFunction);
    /**
    A function used to stringify the body of JSON requests.

    @example
    ```
    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
        }
    });
    ```

    @example
    ```
    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
        }
    });
    ```
    */
    get stringifyJson(): StringifyJsonFunction;
    set stringifyJson(value: StringifyJsonFunction);
    /**
    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`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/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).

    The `enforceRetryRules` property is a `boolean` that, when set to `true` (default), enforces the `limit`, `methods`, `statusCodes`, and `errorCodes` options before calling `calculateDelay`. Your `calculateDelay` function is only invoked when a retry is allowed based on these criteria. When `false`, `calculateDelay` receives the computed value but can override all retry logic.

    __Note:__ When `enforceRetryRules` is `false`, you must check `computedValue` in your `calculateDelay` function to respect retry rules. When `true` (default), the retry rules are enforced automatically.

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

    - `ETIMEDOUT`: One of the [timeout](#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`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header is greater than `maxRetryAfter`, it will cancel the request.
    */
    get retry(): Partial<RetryOptions>;
    set retry(value: Partial<RetryOptions>);
    /**
    From `http.RequestOptions`.

    The IP address used to send the request from.
    */
    get localAddress(): string | undefined;
    set localAddress(value: string | undefined);
    /**
    The HTTP method used to make the request.

    @default 'GET'
    */
    get method(): Method;
    set method(value: Method);
    get createConnection(): CreateConnectionFunction | undefined;
    set createConnection(value: CreateConnectionFunction | undefined);
    /**
    From `http-cache-semantics`

    @default {}
    */
    get cacheOptions(): CacheOptions;
    set cacheOptions(value: CacheOptions);
    /**
    Options for the advanced HTTPS API.
    */
    get https(): HttpsOptions;
    set https(value: HttpsOptions);
    /**
    [Encoding](https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings) to be used on `setEncoding` of the response data.

    To get a [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), 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)`.

    @default 'utf-8'
    */
    get encoding(): BufferEncoding | undefined;
    set encoding(value: BufferEncoding | undefined);
    /**
    When set to `true` the promise will return the Response body instead of the Response object.

    @default false
    */
    get resolveBodyOnly(): boolean;
    set resolveBodyOnly(value: boolean);
    set isStream(value: boolean);
    /**
    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.

    @example
    ```
    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 Uint8Array
    // `json` is an object
    ```

    @example
    ```
    // This
    const body = await got(url).json();

    // is semantically the same as this
    const body = await got(url, {responseType: 'json', resolveBodyOnly: true});
    ```
    */
    get responseType(): ResponseType;
    set responseType(value: ResponseType);
    get pagination(): PaginationOptions<unknown, unknown>;
    set pagination(value: PaginationOptions<unknown, unknown>);
    get auth(): unknown;
    set auth(_value: unknown);
    get setHost(): boolean;
    set setHost(value: boolean);
    get maxHeaderSize(): number | undefined;
    set maxHeaderSize(value: number | undefined);
    get enableUnixSockets(): boolean;
    set enableUnixSockets(value: boolean);
    /**
    Throw an error if the server response's `content-length` header value doesn't match the number of bytes received.

    This is useful for detecting truncated responses and follows RFC 9112 requirements for message completeness.

    __Note__: Responses without a `content-length` header are not validated.
    __Note__: When enabled and validation fails, a `ReadError` with code `ERR_HTTP_CONTENT_LENGTH_MISMATCH` will be thrown.

    @default true
    */
    get strictContentLength(): boolean;
    set strictContentLength(value: boolean);
    toJSON(): {
        timeout: Delays;
        localAddress: string | undefined;
        headers: Headers;
        request: RequestFunction | undefined;
        json: unknown;
        followRedirect: boolean | ((response: PlainResponse) => boolean);
        body: string | Uint8Array | Readable | Generator | AsyncGenerator | Iterable<unknown> | AsyncIterable<unknown> | FormData | ArrayBufferView | undefined;
        url: string | URL | undefined;
        retry: Partial<RetryOptions>;
        agent: Agents;
        h2session: ClientHttp2Session | undefined;
        decompress: boolean;
        prefixUrl: string | URL;
        form: Record<string, any> | undefined;
        cookieJar: PromiseCookieJar | ToughCookieJar | undefined;
        signal: AbortSignal | undefined;
        ignoreInvalidCookies: boolean;
        searchParams: string | SearchParameters | URLSearchParams | undefined;
        dnsLookup: LookupFunction | undefined;
        dnsCache: CacheableLookup | boolean | undefined;
        context: Record<string, unknown>;
        hooks: Hooks;
        maxRedirects: number;
        cache: string | StorageAdapter | boolean | undefined;
        throwHttpErrors: boolean;
        username: string;
        password: string;
        http2: boolean;
        allowGetBody: boolean;
        allowAbsoluteUrls: boolean;
        copyPipedHeaders: boolean;
        methodRewriting: boolean;
        dnsLookupIpVersion: DnsLookupIpVersion;
        parseJson: ParseJsonFunction;
        stringifyJson: StringifyJsonFunction;
        method: Method;
        createConnection: CreateConnectionFunction | undefined;
        cacheOptions: CacheOptions;
        https: HttpsOptions;
        encoding: BufferEncoding | undefined;
        resolveBodyOnly: boolean;
        isStream: boolean;
        responseType: ResponseType;
        pagination: PaginationOptions<unknown, unknown>;
        setHost: boolean;
        maxHeaderSize: number | undefined;
        enableUnixSockets: boolean;
        strictContentLength: boolean;
    };
    createNativeRequestOptions(): {
        ALPNProtocols: string[] | undefined;
        ca: string | Buffer<ArrayBufferLike> | (string | Buffer<ArrayBufferLike>)[] | undefined;
        cert: string | Buffer<ArrayBufferLike> | (string | Buffer<ArrayBufferLike>)[] | undefined;
        key: string | Buffer<ArrayBufferLike> | (string | Buffer<ArrayBufferLike> | import("node:tls").KeyObject)[] | undefined;
        passphrase: string | undefined;
        pfx: PfxType;
        rejectUnauthorized: boolean | undefined;
        checkServerIdentity: CheckServerIdentityFunction | typeof checkServerIdentity;
        servername: string | undefined;
        ciphers: string | undefined;
        honorCipherOrder: boolean | undefined;
        minVersion: import("node:tls").SecureVersion | undefined;
        maxVersion: import("node:tls").SecureVersion | undefined;
        sigalgs: string | undefined;
        sessionTimeout: number | undefined;
        dhparam: string | Buffer<ArrayBufferLike> | undefined;
        ecdhCurve: string | undefined;
        crl: string | Buffer<ArrayBufferLike> | (string | Buffer<ArrayBufferLike>)[] | undefined;
        secureOptions: number | undefined;
        lookup: LookupFunction | {
            (hostname: string, family: import("cacheable-lookup").IPFamily, callback: (error: NodeJS.ErrnoException | null, address: string, family: import("cacheable-lookup").IPFamily) => void): void;
            (hostname: string, callback: (error: NodeJS.ErrnoException | null, address: string, family: import("cacheable-lookup").IPFamily) => void): void;
            (hostname: string, options: import("cacheable-lookup").LookupOptions & {
                all: true;
            }, callback: (error: NodeJS.ErrnoException | null, result: ReadonlyArray<import("cacheable-lookup").EntryObject>) => void): void;
            (hostname: string, options: import("cacheable-lookup").LookupOptions, callback: (error: NodeJS.ErrnoException | null, address: string, family: import("cacheable-lookup").IPFamily) => void): void;
        } | undefined;
        family: DnsLookupIpVersion;
        agent: false | http.Agent | {
            http2: {};
            http?: HttpAgent | false;
            https?: HttpsAgent | false;
        } | undefined;
        setHost: boolean;
        method: Method;
        maxHeaderSize: number | undefined;
        localAddress: string | undefined;
        headers: Headers;
        createConnection: CreateConnectionFunction | undefined;
        timeout: number | undefined;
        h2session: http2wrapper.ClientHttp2Session | undefined;
        socketPath?: string | undefined;
        path?: string | undefined;
        host?: string | undefined;
        shared?: boolean;
        cacheHeuristic?: number;
        immutableMinTimeToLive?: number;
        ignoreCargoCult?: boolean;
    };
    getRequestFunction(): RequestFunction | typeof https.request | undefined;
    freeze(): void;
}
export declare const snapshotCrossOriginState: (options: Options) => CrossOriginState;
export declare const isCrossOriginCredentialChanged: (previousUrl: URL, nextUrl: URL, credential: "username" | "password") => boolean;
export declare const isBodyUnchanged: (options: Options, previousState: CrossOriginState) => boolean;
export {};
