@rushdb/javascript-sdk
Version:
RushDB Javascript SDK
27 lines (26 loc) • 1.39 kB
TypeScript
import type { HttpClientInterface, HttpClientResponseInterface, MakeRequestConfig } from './HttpClient.js';
import type { ResponseHeaders } from './types.js';
import { HttpClient, HttpClientGenericResponse } from './HttpClient.js';
/**
* HTTP client which uses a `fetch` function to issue requests.
*
* By default, relies on the global `fetch` function, but an optional function
* can be passed in. If passing in a function, it is expected to match the Web
* Fetch API. As an example, this could be the function provided by the
* node-fetch package (https://github.com/node-fetch/node-fetch).
*/
export declare class FetchHttpClient extends HttpClient implements HttpClientInterface {
private readonly _fetchFn;
constructor(fetchFn?: typeof fetch);
private static makeFetchWithRaceTimeout;
private static makeFetchWithAbortTimeout;
makeRequest(url: string, { headers, method, protocol, requestData, timeout }: MakeRequestConfig): Promise<HttpClientResponseInterface>;
}
export declare class FetchHttpClientResponse extends HttpClientGenericResponse implements HttpClientResponseInterface {
_res: Response;
constructor(res: Response);
getRawResponse(): Response;
toStream(streamCompleteCallback: () => void): ReadableStream<Uint8Array> | null;
toJSON(): Promise<any>;
static _transformHeadersToObject(headers: Headers): ResponseHeaders;
}