@emartech/escher-request
Version:
Requests with Escher authentication
32 lines (31 loc) • 1.05 kB
TypeScript
import { RequestOptions } from './requestOption';
import { AxiosResponseHeaders, RawAxiosResponseHeaders } from 'axios';
import { Agent as HttpAgent } from 'http';
import { Agent as HttpsAgent } from 'https';
export interface ExtendedRequestOption extends RequestOptions {
method: string;
url: string;
path: string;
httpAgent?: HttpAgent;
httpsAgent?: HttpsAgent;
}
export interface TransformedResponse<T = any> {
body: T;
statusCode: number;
statusMessage: string;
headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
}
export declare class RequestWrapper {
private readonly protocol;
private readonly payload;
private readonly requestOptions;
constructor(requestOptions: ExtendedRequestOption, protocol: string, payload?: any);
send<T = any>(): Promise<TransformedResponse<T>>;
private transformResponse;
private handleResponseError;
private handleResponse;
private isJsonResponse;
private getLogParameters;
private getRequestOptions;
private parseBody;
}