update
This commit is contained in:
@@ -3,7 +3,7 @@ import * as types from './types.js';
|
||||
/**
|
||||
* Abstract Core Request class that defines the interface for all HTTP/HTTPS requests
|
||||
*/
|
||||
export abstract class CoreRequest<TOptions extends types.IAbstractRequestOptions = types.IAbstractRequestOptions, TResponse = any> {
|
||||
export abstract class CoreRequest<TOptions extends types.ICoreRequestOptions = types.ICoreRequestOptions, TResponse = any> {
|
||||
/**
|
||||
* Tests if a URL is a unix socket
|
||||
*/
|
||||
|
@@ -3,14 +3,14 @@ import * as types from './types.js';
|
||||
/**
|
||||
* Abstract Core Response class that provides a fetch-like API
|
||||
*/
|
||||
export abstract class CoreResponse<T = any> implements types.IAbstractResponse<T> {
|
||||
export abstract class CoreResponse<T = any> implements types.ICoreResponse<T> {
|
||||
protected consumed = false;
|
||||
|
||||
// Public properties
|
||||
public abstract readonly ok: boolean;
|
||||
public abstract readonly status: number;
|
||||
public abstract readonly statusText: string;
|
||||
public abstract readonly headers: types.AbstractHeaders;
|
||||
public abstract readonly headers: types.Headers;
|
||||
public abstract readonly url: string;
|
||||
|
||||
/**
|
||||
|
@@ -27,9 +27,10 @@ export interface IUrlEncodedField {
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract request options - platform agnostic
|
||||
* Core request options - unified interface for all implementations
|
||||
*/
|
||||
export interface IAbstractRequestOptions {
|
||||
export interface ICoreRequestOptions {
|
||||
// Common options
|
||||
method?: THttpMethod | string; // Allow string for compatibility
|
||||
headers?: any; // Allow any for platform compatibility
|
||||
keepAlive?: boolean;
|
||||
@@ -37,22 +38,39 @@ export interface IAbstractRequestOptions {
|
||||
queryParams?: { [key: string]: string };
|
||||
timeout?: number;
|
||||
hardDataCuttingTimeout?: number;
|
||||
|
||||
// Node.js specific options (ignored in fetch implementation)
|
||||
agent?: any;
|
||||
socketPath?: string;
|
||||
hostname?: string;
|
||||
port?: number;
|
||||
path?: string;
|
||||
|
||||
// Fetch API specific options (ignored in Node.js implementation)
|
||||
credentials?: RequestCredentials;
|
||||
mode?: RequestMode;
|
||||
cache?: RequestCache;
|
||||
redirect?: RequestRedirect;
|
||||
referrer?: string;
|
||||
referrerPolicy?: ReferrerPolicy;
|
||||
integrity?: string;
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract response headers - platform agnostic
|
||||
* Response headers - platform agnostic
|
||||
*/
|
||||
export type AbstractHeaders = Record<string, string | string[]>;
|
||||
export type Headers = Record<string, string | string[]>;
|
||||
|
||||
/**
|
||||
* Abstract response interface - platform agnostic
|
||||
* Core response interface - platform agnostic
|
||||
*/
|
||||
export interface IAbstractResponse<T = any> {
|
||||
export interface ICoreResponse<T = any> {
|
||||
// Properties
|
||||
ok: boolean;
|
||||
status: number;
|
||||
statusText: string;
|
||||
headers: AbstractHeaders;
|
||||
headers: Headers;
|
||||
url: string;
|
||||
|
||||
// Methods
|
||||
|
Reference in New Issue
Block a user