@zhengxs/http
Version:
A lightweight cross-platform http request library
18 lines (17 loc) • 1.08 kB
TypeScript
/// <reference types="node" />
import { type Readable } from './_shims/index';
import type { Fetch, RequestOptions } from './types';
export { maybeMultipartFormRequestOptions, multipartFormRequestOptions, createForm, type Uploadable, } from './uploads';
export declare const safeJSON: (text: string) => any;
export declare const sleep: (ms: number) => Promise<unknown>;
export declare function isEmptyObj(obj: NonNullable<unknown> | null | undefined): boolean;
export declare function hasOwn(obj: NonNullable<unknown>, key: string): boolean;
export declare function debug(action: string, ...args: any[]): void;
/**
* https://stackoverflow.com/a/2117523
*/
export declare const uuid4: () => string;
export declare const isAbsoluteURL: (url: string) => boolean;
export declare const isRequestOptions: (obj: unknown) => obj is RequestOptions<Record<string, unknown> | Readable>;
export declare const createResponseHeaders: (headers: Awaited<ReturnType<Fetch>>['headers']) => Record<string, string>;
export declare const validatePositiveInteger: (name: string, n: unknown) => number;