Interface ProcessedResponse<T>

Processed response object.

interface ProcessedResponse<T> {
    arrayBuffer: (() => Promise<ArrayBuffer>);
    blob: (() => Promise<Blob>);
    body: null | ReadableStream<any>;
    bodyUsed: boolean;
    clone: (() => Response);
    formData: (() => Promise<FormData>);
    headers: Headers;
    json: (() => Promise<unknown>);
    ok: boolean;
    parsedBody?: T;
    redirected: boolean;
    request: Request;
    status: number;
    statusText: string;
    text: (() => Promise<string>);
    type: ResponseType;
    url: string;
}

Type Parameters

  • T = any

Hierarchy

  • Response
    • ProcessedResponse

Properties

arrayBuffer: (() => Promise<ArrayBuffer>)

Type declaration

    • (): Promise<ArrayBuffer>
    • Returns Promise<ArrayBuffer>

blob: (() => Promise<Blob>)

Type declaration

    • (): Promise<Blob>
    • Returns Promise<Blob>

body: null | ReadableStream<any>
bodyUsed: boolean
clone: (() => Response)

Type declaration

    • (): Response
    • Returns Response

formData: (() => Promise<FormData>)

Type declaration

    • (): Promise<FormData>
    • Returns Promise<FormData>

Deprecated

This method is not recommended for parsing multipart/form-data bodies in server environments. It is recommended to use a library such as @fastify/busboy as follows:

Example

import { Busboy } from '@fastify/busboy'
import { Readable } from 'node:stream'

const response = await fetch('...')
const busboy = new Busboy({ headers: { 'content-type': response.headers.get('content-type') } })

// handle events emitted from `busboy`

Readable.fromWeb(response.body).pipe(busboy)
headers: Headers
json: (() => Promise<unknown>)

Type declaration

    • (): Promise<unknown>
    • Returns Promise<unknown>

ok: boolean
parsedBody?: T

Parsed response body.

redirected: boolean
request: Request

Fetch request object.

status: number
statusText: string
text: (() => Promise<string>)

Type declaration

    • (): Promise<string>
    • Returns Promise<string>

type: ResponseType
url: string