window.Response
Response class represents a resource request.
Since: v7.3.0
Response([body], [options])
string | Blob | ArrayBuffer | TypedArray | FormData | ReadableStream | URLSearchParamsnullObject{}number200stringHeaders | string{}body : ReadableStream
Read only ReadableStream object with the body contents or null if response's body is empty.
See: Response - body
bodyUsed : boolean
Read only Indicates whether the response body has been read yet.
See: Response - bodyUsed
headers : Headers
Read only Headers object associated with the response.
See: Response - headers
ok : boolean
Read only Indicates whether the response was successful (if status is in range 200-299) or not.
See: Response - ok
status : number
Read only HTTP status codes of the response.
See: Response - status
statusText : string
Read only Status message corresponding to the HTTP status code. Default is "".
url : string
Read only URL of the response.
See: Response - url
arrayBuffer()
Reads the response stream to completion and returns it as a Promise that resolves with an ArrayBuffer.
Returns: Promise<ArrayBuffer> Promise that resolves with an ArrayBuffer.
See: Response - arrayBuffer
blob()
Reads the response stream to completion and returns it as a Promise that resolves with a Blob.
Returns: Promise<Blob> Promise that resolves with a Blob.
See: Response - blob
clone()
Creates a copy of the current response object.
Returns: Response - Copy of the response.
See: Response - clone
formData()
Reads the response stream to completion and returns it as a Promise that resolves with a FormData.
Returns: Promise<FormData> Promise that resolves with a FormData.
See: Response - formData
json()
Reads the response stream to completion and returns it as a Promise that resolves with the result of parsing the body text as JSON.
Returns: Promise<Object> Promise that resolves to JSON object.
See: Response - json
text()
Reads the response stream to completion and returns it as a Promise that resolves with a String decoded using UTF-8.
Returns: Promise<string> Promise that resolves with a String.
See: Response - text
error()
Returns: Response - Response object
See: Response - error
redirect(url, [status])
Returns: Response - Response object
Throws:
RangeErrorIf status is not one of 301, 302, 303, 307, 308.
See: Response - redirect
stringnumber302