UNPKG

danger

Version:
22 lines (21 loc) 919 B
/// <reference types="node" /> import type { Request, RequestInit, Response } from "undici"; export type FetchResponse = Omit<Response, "json"> & { json(): Promise<any>; }; /** * Adds retry handling to fetch requests * * @param {(string | fetch.Request)} url the request * @param {fetch.RequestInit} [init] the usual options * @returns {Promise<fetch.Response>} network-y promise */ export declare function retryableFetch(url: string | Request, init: RequestInit): Promise<FetchResponse>; /** * Adds logging to every fetch request if a global var for `verbose` is set to true * * @param {(string | fetch.Request)} url the request * @param {fetch.RequestInit} [init] the usual options * @returns {Promise<fetch.Response>} network-y promise */ export declare function api(url: string | Request, init: RequestInit, suppressErrorReporting?: boolean, processEnv?: NodeJS.ProcessEnv): Promise<FetchResponse>;