@gam-test/fetch-wrapper
Version:
A simple fetch wrapper for better error handling and less response context
19 lines (16 loc) • 473 B
TypeScript
import { RequestClientConfig } from './ClientConfig.js';
type Params = {
url: string;
};
type HttpResponse<R> = {
status: number;
headers: Headers;
body?: R;
};
declare abstract class HttpClient {
protected url: string;
constructor({ url }: Params);
protected abstract connect<T, R>(config: RequestClientConfig<T, R>): Promise<Response>;
request<T, R>(config: RequestClientConfig<T, R>): Promise<HttpResponse<R>>;
}
export { HttpClient };