FetchLike: (
url: string,
init?: {
body?: string;
headers?: Record<string, string>;
method?: string;
redirect?: "follow" | "error" | "manual";
signal?: AbortSignal;
},
) => Promise<
{
headers: { get(name: string): string | null };
status: number;
text(): Promise<string>;
},
>
Type Declaration
-
- (
url: string,
init?: {
body?: string;
headers?: Record<string, string>;
method?: string;
redirect?: "follow" | "error" | "manual";
signal?: AbortSignal;
},
): Promise<
{
headers: { get(name: string): string | null };
status: number;
text(): Promise<string>;
},
>
-
Parameters
- url: string
Optionalinit: {
body?: string;
headers?: Record<string, string>;
method?: string;
redirect?: "follow" | "error" | "manual";
signal?: AbortSignal;
}
Returns Promise<
{
headers: { get(name: string): string | null };
status: number;
text(): Promise<string>;
},
>
Minimal fetch contract (global fetch, expo fetch and test doubles all satisfy it).
redirecthas the Fetch standard meaning:'error'asks the implementation to fail instead of following a redirect.