UNPKG

@prismicio/client

Version:

The official JavaScript + TypeScript client library for Prismic

61 lines (60 loc) 1.65 kB
//#region src/lib/request.d.ts /** * A universal API to make network requests. A subset of the `fetch()` API. * * {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch} */ type FetchLike = (input: string, init?: RequestInitLike) => Promise<ResponseLike>; /** * An object that allows you to abort a `fetch()` request if needed via an * `AbortController` object * * {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal} */ type AbortSignalLike = any; /** * A subset of RequestInit properties to configure a `fetch()` request. */ interface RequestInitLike extends Pick<RequestInit, "cache"> { /** * The HTTP method to use for the request. */ method?: string; /** * The request body to send with the request. */ body?: any | FormData | string; /** * An object literal to set the `fetch()` request's headers. */ headers?: Record<string, string>; /** * An AbortSignal to set the `fetch()` request's signal. * * See: * [https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) */ signal?: AbortSignalLike; } /** * The minimum required properties from Response. */ interface ResponseLike { ok: boolean; status: number; headers: HeadersLike; url: string; json(): Promise<any>; text(): Promise<string>; blob(): Promise<Blob>; clone(): ResponseLike; } /** * The minimum required properties from Headers. */ interface HeadersLike { get(name: string): string | null; } //#endregion export { AbortSignalLike, FetchLike, RequestInitLike, ResponseLike }; //# sourceMappingURL=request.d.cts.map