/// <reference types="node" />
import { CdpHeaders } from '../../cdp/index.js';
import { Logger } from '../../logger.js';
import { BlobService } from './blob.js';
import { BrowserService } from './browser.js';
import { ProxyService } from './proxy.js';
export declare const RETRIABLE_ERRORS: string[];
export type FetchMode = 'Fetch' | 'Node' | 'Node+Proxy';
export interface FetchRequestSpec {
    mode: FetchMode;
    requestBodyFormat: RequestBodyFormat;
    responseBodyFormat: ResponseBodyFormat;
    retries: number;
    timeout: number;
    method: string;
    url: string;
    headers: CdpHeaders;
    body: any;
}
export interface FetchResponseSpec {
    url: string;
    status: number;
    statusText: string;
    headers: CdpHeaders;
    body: any | null;
}
export type RequestBodyFormat = 'none' | 'json' | 'text' | 'multipart' | 'urlencoded';
export type ResponseBodyFormat = 'none' | 'json' | 'text' | 'urlencoded' | 'blob' | 'base64';
export interface RequestBodySpec {
    body: string;
    headers: CdpHeaders;
}
export declare class FetchService {
    protected blobs: BlobService;
    protected logger: Logger;
    protected browser: BrowserService;
    protected proxy: ProxyService;
    constructor(blobs: BlobService, logger: Logger, browser: BrowserService, proxy: ProxyService);
    send(_spec: Partial<FetchRequestSpec>): Promise<FetchResponseSpec>;
    prepareRequestSpec(spec: Partial<FetchRequestSpec>): Promise<FetchRequestSpec>;
    protected prepareRequestHeaders(spec: Partial<FetchRequestSpec>): CdpHeaders;
    protected prepareRequestBody(spec: Partial<FetchRequestSpec>): Promise<RequestBodySpec>;
    prepareMultipartRequestBody(spec: Partial<FetchRequestSpec>): Promise<RequestBodySpec>;
    sendWithRetries(spec: FetchRequestSpec): Promise<FetchResponseSpec>;
    protected sendSingleRequest(spec: FetchRequestSpec): Promise<FetchResponseSpec>;
    sendFetchRequestWithTimeout(spec: FetchRequestSpec): Promise<FetchResponseSpec>;
    sendFetchRequest(spec: FetchRequestSpec): Promise<FetchResponseSpec>;
    sendNodeRequest(spec: FetchRequestSpec, useProxy: boolean): Promise<FetchResponseSpec>;
    protected parseResponseBody(spec: FetchRequestSpec, buffer: Buffer): Promise<any>;
}
//# sourceMappingURL=fetch.d.ts.map