Hierarchy
- FetchResponse
Properties
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');
ok
Short flag indicating that the response code is less than 300.
size
Response size in bytes.
status
HTTP response code.
For more information about codes, see HttpStatusCode.
statusText
Text view of the response code.
timeout
Request execution timeout in milliseconds.
type
Type of the response.
url
Address of the resource.
Methods
arrayBuffer
-
Wait for the complete response and return is as an array of binary data.
Returns Promise<ArrayBuffer>
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