Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function assertOkResponse(response) {
if (response.type === 'opaque' || response.status === 200) {
return response;
throw Error("Bad response: " + response.status);
fetch(url, {'mode': 'cors'}).then(assertOkResponse).then(function(response) {
// cache
}).catch(function(err) {
console.error('Fetch Error :-S', err);
throw err;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.