index.d.ts
1.23 KB
export declare class HttpError extends Error {
status: number;
constructor(status: number, message: string);
}
export interface HttpResponsePromise extends Promise<string | ArrayBuffer> {
abort: () => void;
}
export declare class HttpClient {
private serverBaseUrl;
private authorization;
private maxConcurrency;
private currentRequestNum;
private pendingRequests;
private responsePreprocessor;
constructor(baseUrl: string, maxConcurrency?: number);
setAuthorization(authorization: string): void;
setResponsePreprocessor(func: (response: string | ArrayBuffer | Blob) => string | ArrayBuffer): void;
get(path?: string, timeout?: number, headers?: {
[key: string]: string;
}): HttpResponsePromise;
post(path?: string, timeout?: number, body?: string | ArrayBuffer, contentType?: string, headers?: {
[key: string]: string;
}): HttpResponsePromise;
put(path?: string, timeout?: number, body?: string | ArrayBuffer, contentType?: string, headers?: {
[key: string]: string;
}): HttpResponsePromise;
delete(path?: string, timeout?: number, headers?: {
[key: string]: string;
}): HttpResponsePromise;
private _handleRequest;
private _doRequest;
}