UNPKG

@signumjs/http

Version:
27 lines (26 loc) 1.03 kB
import { HttpResponse } from './httpResponse'; import { Http } from './http'; import { HttpClientOptions } from './httpClientOptions'; /** * Http implementation of {@link Http} using the platform's native `fetch`. * * Works in browsers, Node.js >= 18, Deno, Bun and Cloudflare Workers without * any external dependency. * * Prefer {@link HttpClientFactory.createHttpClient} to create an instance. * * @module http */ export declare class HttpAdapterFetch implements Http { private readonly _baseURL; private readonly _defaults; constructor(baseURL: string, options?: HttpClientOptions); get(url: string, options?: HttpClientOptions): Promise<HttpResponse>; post(url: string, payload: any, options?: HttpClientOptions): Promise<HttpResponse>; put(url: string, payload: any, options?: HttpClientOptions): Promise<HttpResponse>; delete(url: string, options?: HttpClientOptions): Promise<HttpResponse>; private buildUrl; private resolveOptions; private request; private parseBody; }