/** * @module request */ import type { IRequest, IResponse } from 'jodit/types'; export class Response implements IResponse { readonly status: number; readonly statusText: string; readonly request: IRequest; get url(): string { return this.request.url; } private readonly body: string | Blob; constructor( request: IRequest, status: number, statusText: string, body: string | Blob ) { this.request = request; this.status = status; this.statusText = statusText; this.body = body; } async json(): Promise { return JSON.parse(this.body as string); } text(): Promise { return Promise.resolve(this.body as string); } async blob(): Promise { return this.body as Blob; } }