ApplesauceOS
Read Markdown ↗Download .md

Response.properties

Read HTTP response state.

js
response.status; response.ok; response.url; response.bodyUsed

Arguments

No arguments.

Returns

status is a number; ok is true for 200..299; url is the response URL; bodyUsed indicates text()/json() consumption.

Example

js
fetch("https://example.com").then(response => {
  console.log(response.status, response.ok, response.bodyUsed);
}).catch(error => { console.error(error.message); throw error; });

Notes

HTTP 4xx/5xx resolve to a response. Check ok/status before consuming the body.

All JavaScript APIs · Automation playbook