Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is response.ok true for any 2xx HTTP status?

Is response.ok true for any 2xx HTTP status? If so, why? Shouldn’t it be only for a 200 status code?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The fetch specs state, that a response returns true if the response status has an OK status.

An ok status is a status in the range 200 to 299, inclusive.

The reason for this seems to, that a 2xx status yields a successfull response, which is pretty common for 201, 206 etc. in the RESTful world.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading