class Response
implements Body
This Fetch API interface represents the response to a request.
Constructors
new
Response(body?: BodyInit | null, init?: ResponseInit)Properties
readonly
body: ReadableStream<Uint8Array> | nullA simple getter used to expose a ReadableStream
of the body contents.
readonly
headers: Headersreadonly
trailer: Promise<Headers>readonly
type: ResponseTypeMethods
arrayBuffer(): Promise<ArrayBuffer>
Takes a Response
stream and reads it to completion. It returns a promise
that resolves with an ArrayBuffer
.
Takes a Response
stream and reads it to completion. It returns a promise
that resolves with a FormData
object.
json(): Promise<any>
Takes a Response
stream and reads it to completion. It returns a promise
that resolves with the result of parsing the body text as JSON.
text(): Promise<string>
Takes a Response
stream and reads it to completion. It returns a promise
that resolves with a USVString
(text).