import type { SendRequestInput, SendResult } from './types.js'; import { type RequestSettings } from './settings.js'; import type { IBody } from './IBody.js'; import type { IHeaders } from './IHeaders.js'; import type { IQueryString } from './IQueryString.js'; import type { IRequester } from './IRequester.js'; import type { IRequestTiming } from './IRequestTiming.js'; import type { IResponseReader } from './IResponseReader.js'; /** HTTP status codes treated as redirects when following manually. */ export declare const REDIRECT_STATUSES: Set; /** Maximum redirect hops before returning an error. */ export declare const MAX_REDIRECTS = 20; /** * Optional collaborators injected into {@link IRequester} implementations. */ export interface RequesterDeps { queryString?: IQueryString; headers?: IHeaders; body?: IBody; responseReader?: IResponseReader; timing?: IRequestTiming; } /** * Executes outbound HTTP requests via fetch with configurable collaborators. */ export declare class Requester implements IRequester { private readonly queryString; private readonly headers; private readonly body; private readonly responseReader; private readonly timing; /** * Creates a requester with optional collaborators defaulting to the standard implementations. * * @param deps - Optional query string, header, body, and response reader implementations. */ constructor(deps?: RequesterDeps); /** * Combines optional cancel and timeout signals for fetch. * * @param signal - Optional user cancel signal. * @param timeoutMs - Request timeout in milliseconds; 0 disables timeout. */ private buildEffectiveSignal; /** * Maps fetch errors to user-facing messages. * * @param err - Thrown fetch error. * @param timeoutMs - Configured request timeout in milliseconds. */ private mapFetchError; /** * Returns a shared undici Agent that skips TLS certificate verification. */ private getInsecureDispatcher; /** * Builds a failed {@link SendResult} with consistent error fields. * * @param error - User-facing error message. * @param request - Sent request metadata captured before or during the attempt. * @param timeMs - Elapsed time in milliseconds. * @param timing - Optional best-effort phase timing captured before the error. * @param responseHeaders - Optional response headers when available before failure. * @param setCookieHeaders - Optional Set-Cookie headers from the response. */ private errorResult; /** * Logs the outbound request when very-verbose mode is enabled. * * Records the HTTP verb, resolved URL, request headers, body type, and request * body. Response headers and response bodies are intentionally omitted. * * @param request - Final request metadata sent to fetch. */ private logOutgoingRequest; /** * Builds the fetch request body for one hop. * * @param input - Original send input (body source). * @param bodyType - Body type for this hop. * @param shouldSendBody - Whether a body should be attached. */ private buildRequestBody; /** * Resolves the fetch dispatcher from general settings. * * @param settings - General request settings. */ private resolveDispatcher; /** * Executes an HTTP request via fetch and returns timing and response metadata. * * When redirect following is enabled, 3xx responses are followed manually so * each hop can be recorded in {@link SendResult.redirects}. * * @param input - Method, URL, headers, params, body, and body type. * @param settings - General request settings for timeout, size limits, SSL verification, and redirect following. * @param signal - Optional abort signal to cancel the in-flight request. * @param cookieHeader - Optional Cookie header value from the cookie jar. * @returns Response status, headers, body, timing, size, and optional redirect chain; error field on failure. */ executeRequest(input: SendRequestInput, settings?: RequestSettings, signal?: AbortSignal, cookieHeader?: string): Promise; } //# sourceMappingURL=Requester.d.ts.map