Bloc / Messenger

This is a small app to message using the Bloc Api
8 stars 3 forks source link

A more precise check for a successful POST response from fetch #42

Closed drbeowulf closed 8 years ago

drbeowulf commented 8 years ago

For a POST response, instead of checking to see if the response status is less than 400, it is probably more precise to check if the response status falls in the range of 200-299. The web API has a response property response.ok that returns a boolean if the POST, GET, PUT, or DELETE was successful within the 200-299 range.

The attached link explains https://developer.mozilla.org/en-US/docs/Web/API/Response/ok

Might want to also see the fetch documentation on this as well https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

drbeowulf commented 8 years ago

This has been added to #47