UNPKG

@waiting/fetch

Version:

HTTP fetch API for browser and Node.js. Handle 302/303 redirect correctly on Node.js

40 lines 1.5 kB
import type { Options, ResponseData } from './types.js'; import { Headers } from './types.js'; /** * Fetch with strict types * * @description generics any will be overwritten to unknown */ export declare function fetch<T extends ResponseData>(options: Options): Promise<T>; /** * Fetch with strict types * * @returns [result, response header] * @description generics any will be overwritten to unknown */ export declare function fetch2<T extends ResponseData>(options: Options): Promise<[T, Headers]>; /** * Fetch Get with strict types, default response is JSON * * @description generics any will be overwritten to unknown */ export declare function get<T extends ResponseData>(url: string, options?: Omit<Options, 'url' | 'method'>): Promise<T>; /** * Fetch Post with strict types * * @description generics any will be overwritten to unknown */ export declare function post<T extends ResponseData>(url: Options['url'], options?: Omit<Options, 'url' | 'method'>): Promise<T>; /** * Fetch Put with strict types * * @description generics any will be overwritten to unknown */ export declare function put<T extends ResponseData>(url: Options['url'], options?: Omit<Options, 'url' | 'method'>): Promise<T>; /** * Fetch delete with strict types * * @description generics any will be overwritten to unknown */ export declare function remove<T extends ResponseData>(url: Options['url'], options?: Omit<Options, 'url' | 'method'>): Promise<T>; //# sourceMappingURL=fetch.d.ts.map