import { ReadableStream } from "web-streams-polyfill"; import { Stringfiable } from "../types/stringifiable"; import { Headers, HeadersInit } from "./headers"; /** Represents a HTTP method. */ export declare type Method = "GET" | "HEAD" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS"; /** * Specifies what to do in case of a redirect. * * Redirects can either be followed automatically or not, or the * fetch request can be set to fail if a redirect is encountered. Default is `follow`. */ export declare type RedirectPolicy = "follow" | "manual" | "error"; /** Represents a request body. */ export declare type HttpBody = string | ArrayBuffer | ArrayBufferView | ReadableStream; /** Request initialization data. */ export interface RequestInit { /** * The request body to send. * * Notice GET and HEAD requests must not have a body. Initializing a `Request` * of type GET or HEAD with a body will throw. */ body?: HttpBody | null; /** Request headers to send. */ headers?: HeadersInit; /** The HTTP method to use. */ method: Method; /** What to do in case of redirects. */ redirect?: RedirectPolicy; } /** Represents an HTTP request. */ export declare class Request implements RequestInit { #private; /** * Constructs a new HTTP request. * * @param resource The resource to fetch. Can either be a URL or another request that is then cloned. * @param init Optional request initialization. */ constructor(resource: string | Stringfiable | Request, init?: RequestInit); /** Gets the requests' body. */ get body(): HttpBody | null; /** Returns whether the body was used. */ get bodyUsed(): boolean; /** Provides access to the request's header map. */ get headers(): Headers; /** Returns the request method used. */ get method(): Method; /** Gets the redirect policy to use. */ get redirect(): RedirectPolicy; /** Returns the request's URL. */ get url(): string; private assignFrom; }