@logcomex/aylawc-core
Version:
An experimental library of web components
19 lines (18 loc) • 655 B
TypeScript
import type { URL } from '../@shared/interfaces/value-objects.interface';
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
export type HttpHeader = Record<string, string>;
interface HttpErrorInterface {
status: number;
response: any;
}
export declare class HttpError extends Error {
constructor(error: HttpErrorInterface);
parse(): HttpError;
}
export interface HttpAdapter {
useDefaultHeaders: boolean;
setHeaders: (headers: HttpHeader) => void;
getDefaultHeaders: () => HttpHeader;
request: <Response, Payload = {}>(method: HttpMethod, url: URL, payload?: Payload) => Promise<Response>;
}
export {};