import * as querystring from "querystring"; import type Dispatcher from "undici/types/dispatcher"; import type { OutgoingHttpHeaders } from "undici/types/header"; export interface DoHttpRequestOpts { errorHandler?: (response: Dispatcher.ResponseData, body: any) => Error | undefined; } export type ResponseBody = NoEncoding extends true ? Buffer : any; export type RawResponse = Omit & { body: ResponseBody; }; /** * Performs a web request to a server. * @category Unit testing * @param baseUrl The base URL to apply to the call. * @param method The HTTP method to use in the request * @param endpoint The endpoint to call. For example: "/_matrix/client/v3/account/whoami" * @param qs The query string to send. Optional. * @param body The request body to send. Optional. Will be converted to JSON unless the type is a Buffer. * @param headers Additional headers to send in the request. * @param timeout The number of milliseconds to wait before timing out. * @param raw If true, the raw response will be returned instead of the response body. * @param contentType The content type to send. Only used if the `body` is a Buffer. * @param noEncoding Set to true to disable encoding, and return a Buffer. Defaults to false * @returns Resolves to the response (body), rejected if a non-2xx status code was returned. */ export declare function doHttpRequest(baseUrl: string, method: "GET" | "POST" | "PUT" | "DELETE", endpoint: string, qs?: querystring.ParsedUrlQueryInput | null, body?: any | null, headers?: OutgoingHttpHeaders, timeout?: number, raw?: IsRaw, contentType?: string, noEncoding?: NoEncoding, opts?: DoHttpRequestOpts): Promise : ResponseBody>; export declare function redactObjectForLogging(input: any): any;