@push.rocks/smartrequest
Version:
A module for modern HTTP/HTTPS requests with support for form data, file uploads, JSON, binary data, streams, and more.
41 lines (40 loc) • 1.31 kB
TypeScript
import * as plugins from './plugins.js';
import * as types from './types.js';
import { CoreResponse } from './response.js';
/**
* Core Request class that handles all HTTP/HTTPS requests
*/
export declare class CoreRequest {
/**
* 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;
};
private url;
private options;
private requestDataFunc;
constructor(url: string, options?: types.ICoreRequestOptions, requestDataFunc?: ((req: plugins.http.ClientRequest) => void) | null);
/**
* Fire the request and return a CoreResponse
*/
fire(): Promise<CoreResponse>;
/**
* Fire the request and return the raw IncomingMessage
*/
fireCore(): Promise<plugins.http.IncomingMessage>;
/**
* Static factory method to create and fire a request
*/
static create(url: string, options?: types.ICoreRequestOptions): Promise<CoreResponse>;
}
/**
* Convenience exports for backward compatibility
*/
export declare const isUnixSocket: typeof CoreRequest.isUnixSocket;
export declare const parseUnixSocketUrl: typeof CoreRequest.parseUnixSocketUrl;