why 401 status code doesn't trigger `response.ok` to be false?

hi, i think this is a misunderstanding of the fetch API. Is response.ok a boolean to validate if the request was succesfull or to validate if the request was sent successfully?
3 Replies
Alex
Alex9mo ago
The ok read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not. https://developer.mozilla.org/en-US/docs/Web/API/Response/ok
MDN Web Docs
Response: ok property - Web APIs | MDN
The ok read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.
Alex
Alex9mo ago
A 401 should return ok=false
Huilen
HuilenOP9mo ago
oh i was getting a ok=true on a 401 thats weird
Want results from more Discord servers?
Add your server