import { Request, RequestInit } from "../http/request"; import { Response } from "../http/response"; import { Stringfiable } from "../types/stringifiable"; /** A programmatic representation of the error that occured while performing the fetch. */ export declare type ErrorCode = "encoding-mismatch" | "illegal-target" | "invalid-url" | "other" | "redirect-encountered" | "redirect-follow-not-allowed" | "redirect-loop-encountered"; /** Represents an error that occured while performing a fetch request. */ export declare class FetchError extends Error { /** The specific error code. */ readonly code: ErrorCode; } /** A fetch response as passed to JS from Rust. */ export interface ResponseDescriptor { body: number; headers: Record; status: number; } /** * Asynchronously fetches the given HTTP resource. * * @param resource The resource to fetch. This can either be a URL or an instance * of the `Request` class. * @param init Request parameters overriding what is specified in the given * `Request`, if any. * @returns {Promise} Returns a promise that resolves to the HTTP response. */ export declare const fetch: (resource: string | Stringfiable | Request, init?: RequestInit | undefined) => Promise;