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
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.
A 401 should return ok=false
oh
i was getting a ok=true on a 401
thats weird