UNPKG

@push.rocks/smartrequest

Version:

A module for modern HTTP/HTTPS requests with support for form data, file uploads, JSON, binary data, streams, and more.

29 lines (28 loc) 884 B
import * as types from './types.js'; /** * Abstract Core Request class that defines the interface for all HTTP/HTTPS requests */ export declare abstract class CoreRequest<TOptions extends types.ICoreRequestOptions = types.ICoreRequestOptions, TResponse = any> { /** * Tests if a URL is a unix socket */ static isUnixSocket(url: string): boolean; /** * Parses socket path and route from unix socket URL */ static parseUnixSocketUrl(url: string): { socketPath: string; path: string; }; protected url: string; protected options: TOptions; constructor(url: string, options?: TOptions); /** * Fire the request and return a response */ abstract fire(): Promise<TResponse>; /** * Fire the request and return the raw response (platform-specific) */ abstract fireCore(): Promise<any>; }