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.

40 lines (39 loc) 1.06 kB
import * as types from './types.js'; import { CoreResponse as AbstractCoreResponse } from '../core_base/response.js'; /** * Fetch-based implementation of Core Response class */ export declare class CoreResponse<T = any> extends AbstractCoreResponse<T> implements types.IFetchResponse<T> { private response; private responseClone; readonly ok: boolean; readonly status: number; readonly statusText: string; readonly headers: types.Headers; readonly url: string; constructor(response: Response); /** * Parse response as JSON */ json(): Promise<T>; /** * Get response as text */ text(): Promise<string>; /** * Get response as ArrayBuffer */ arrayBuffer(): Promise<ArrayBuffer>; /** * Get response as a readable stream (Web Streams API) */ stream(): ReadableStream<Uint8Array> | null; /** * Node.js stream method - not available in browser */ streamNode(): never; /** * Get the raw Response object */ raw(): Response; }