Hierarchy
- FetchResponse
Properties
Readonly body
Response as a stream.
Readonly bodyUsed
Whether body
was used.
Readonly headers
Response headers.
const result = await fetch('https://yandex.ru');
// Getting a list of response headers as JSON files
const headersJson = JSON.stringify(Object. fromEntries(result.headers));
// Getting the value of a response header
const setCookie = result.headers.get('set-cookie');
Readonly ok
Short flag indicating that the response code is less than 300.
Readonly size
Response size in bytes.
Readonly status
HTTP response code.
For more information about codes, see HttpStatusCode.
Readonly statusText
Text view of the response code.
Readonly timeout
Request execution timeout in milliseconds.
Readonly type
Type of the response.
Readonly url
Address of the resource.
Methods
arrayBuffer
-
Wait for the complete response and return is as an array of binary data.
Returns Promise<ArrayBuffer>
blob
-
Wait for the complete response and return in as a Blob.
Returns Promise<Blob>
json
-
Wait for the complete response and parse it as JSON.
Returns Promise<any>
text
-
Wait for the complete response and return it as text.
Returns Promise<string>
Request result