HttpResponse class

HTTP response class

Constructors

HttpResponse(HttpResponseInit)

Properties

arrayBuffer

Returns a promise fulfilled with the body as an ArrayBuffer

blob

Returns a promise fulfilled with the body as a Blob

body

Returns the body as a ReadableStream

bodyUsed

Returns whether the body has been read from

cookies

HTTP response cookies

enableContentNegotiation

Enable content negotiation of response body if true If false, treat response body as raw

formData

Returns a promise fulfilled with the body as FormData

headers

HTTP response headers.

json

Returns a promise fulfilled with the body parsed as JSON

status

HTTP response status code

text

Returns a promise fulfilled with the body as a string

Constructor Details

HttpResponse(HttpResponseInit)

new HttpResponse(responseInit?: HttpResponseInit)

Parameters

responseInit
HttpResponseInit

Property Details

arrayBuffer

Returns a promise fulfilled with the body as an ArrayBuffer

arrayBuffer: () => Promise<ArrayBuffer>

Property Value

() => Promise<ArrayBuffer>

blob

Returns a promise fulfilled with the body as a Blob

blob: () => Promise<Blob>

Property Value

() => Promise<Blob>

body

Returns the body as a ReadableStream

body: null | ReadableStream<any>

Property Value

null | ReadableStream<any>

bodyUsed

Returns whether the body has been read from

bodyUsed: boolean

Property Value

boolean

cookies

HTTP response cookies

cookies: Cookie[]

Property Value

Cookie[]

enableContentNegotiation

Enable content negotiation of response body if true If false, treat response body as raw

enableContentNegotiation: boolean

Property Value

boolean

formData

Returns a promise fulfilled with the body as FormData

formData: () => Promise<FormData>

Property Value

() => Promise<FormData>

headers

HTTP response headers.

headers: Headers

Property Value

Headers

json

Returns a promise fulfilled with the body parsed as JSON

json: () => Promise<unknown>

Property Value

() => Promise<unknown>

status

HTTP response status code

status: number

Property Value

number

text

Returns a promise fulfilled with the body as a string

text: () => Promise<string>

Property Value

() => Promise<string>