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.

53 lines (52 loc) 1.81 kB
import * as types from './types.js'; import { CoreResponse } from './response.js'; import { CoreRequest as AbstractCoreRequest } from '../core_base/request.js'; /** * Deno implementation of Core Request class using native fetch with unix socket support via HttpClient */ export declare class CoreRequest extends AbstractCoreRequest<types.IDenoRequestOptions, CoreResponse> { private timeoutId; private abortController; private createdClient; private requestDataFunc; constructor(url: string, options?: types.IDenoRequestOptions, requestDataFunc?: ((req: any) => void) | null); /** * Get or create an HttpClient for unix socket communication */ private getHttpClient; /** * Build the full URL with query parameters */ private buildUrl; /** * Convert our options to fetch RequestInit */ private buildFetchOptions; /** * Fire the request and return a CoreResponse */ fire(): Promise<CoreResponse>; /** * Fire the request and return the raw Response */ fireCore(): Promise<Response>; /** * Clear the timeout and abort controller * Note: We don't close the HttpClient here as it's cached for reuse */ private clearTimeout; /** * Static factory method to create and fire a request */ static create(url: string, options?: types.IDenoRequestOptions): Promise<CoreResponse>; /** * Static method to clear the HttpClient cache * Call this when you want to force new clients to be created */ static clearClientCache(): void; } /** * Convenience exports for backward compatibility */ export declare const isUnixSocket: typeof AbstractCoreRequest.isUnixSocket; export declare const parseUnixSocketUrl: typeof AbstractCoreRequest.parseUnixSocketUrl;