/// /// /// import { IncomingHttpHeaders } from "http"; import { Dispatcher } from "undici"; import { RequestResponse, ReqOptions } from "./request"; export declare const DEFAULT_HEADER: { "user-agent": string; }; export declare function isAsyncIterable(value: any): boolean; /** * @description Get a valid Node.js charset from the "content-type" http header. * @see https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings */ export declare function getEncodingCharset(charset?: string): BufferEncoding; /** * @description Parse Undici ResponseData (the body is a Node.js Readable Stream). * If the response as a content type equal to 'application/json' we automatically parse it with JSON.parse(). */ export declare function parseUndiciResponse(response: Dispatcher.ResponseData): Promise; /** * @description Create a default plain Object headers that will contains a Set of default values like: * - User-agent * - Authorization */ export declare function createHeaders(options: Partial>): IncomingHttpHeaders; export declare function json(object: any): string; export declare function createBody(body: undefined): undefined; export declare function createBody(body: any, headers?: IncomingHttpHeaders): string | Buffer; /** * @description Helpers function to generate an Error with all the required properties from the response. * We attach them to the error so that they can be retrieved by the developer in a Catch block. */ export declare function toError(response: RequestResponse): Error & RequestResponse; /** * @description Helpers to generate a Basic or Bearer token for the HTTP Authorization header. * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization */ export declare function createAuthorizationHeader(authorizationHeaderValue: string): string; export declare const env: NodeJS.ProcessEnv; export declare function getCurrentEnv(): "dev" | "prod" | "preprod";