{"action":"created","issue":{"url":"https://api.github.com/repos/whatwg/fetch/issues/103","labels_url":"https://api.github.com/repos/whatwg/fetch/issues/103/labels{/name}","comments_url":"https://api.github.com/repos/whatwg/fetch/issues/103/comments","events_url":"https://api.github.com/repos/whatwg/fetch/issues/103/events","html_url":"https://github.com/whatwg/fetch/issues/103","id":99169868,"number":103,"title":"Option to require response.ok","user":{"login":"jakearchibald","id":93594,"avatar_url":"https://avatars.githubusercontent.com/u/93594?v=3","gravatar_id":"","url":"https://api.github.com/users/jakearchibald","html_url":"https://github.com/jakearchibald","followers_url":"https://api.github.com/users/jakearchibald/followers","following_url":"https://api.github.com/users/jakearchibald/following{/other_user}","gists_url":"https://api.github.com/users/jakearchibald/gists{/gist_id}","starred_url":"https://api.github.com/users/jakearchibald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakearchibald/subscriptions","organizations_url":"https://api.github.com/users/jakearchibald/orgs","repos_url":"https://api.github.com/users/jakearchibald/repos","events_url":"https://api.github.com/users/jakearchibald/events{/privacy}","received_events_url":"https://api.github.com/users/jakearchibald/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-08-05T10:00:51Z","updated_at":"2015-08-10T10:42:53Z","closed_at":null,"body":"Something like:\r\n\r\n```js\r\nfetch(url, {\r\n  requiredStatus: 'ok'\r\n})\r\n```\r\n\r\n…which would cause `fetch` to reject if `response.ok` is false. Default value would be `any`. It could be a boolean, but a value like this means we could let the developer require a specific status code.\r\n\r\nThis would always reject with no-cors requests to avoid x-origin leakage."},"comment":{"url":"https://api.github.com/repos/whatwg/fetch/issues/comments/129404153","html_url":"https://github.com/whatwg/fetch/issues/103#issuecomment-129404153","issue_url":"https://api.github.com/repos/whatwg/fetch/issues/103","id":129404153,"user":{"login":"jakearchibald","id":93594,"avatar_url":"https://avatars.githubusercontent.com/u/93594?v=3","gravatar_id":"","url":"https://api.github.com/users/jakearchibald","html_url":"https://github.com/jakearchibald","followers_url":"https://api.github.com/users/jakearchibald/followers","following_url":"https://api.github.com/users/jakearchibald/following{/other_user}","gists_url":"https://api.github.com/users/jakearchibald/gists{/gist_id}","starred_url":"https://api.github.com/users/jakearchibald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakearchibald/subscriptions","organizations_url":"https://api.github.com/users/jakearchibald/orgs","repos_url":"https://api.github.com/users/jakearchibald/repos","events_url":"https://api.github.com/users/jakearchibald/events{/privacy}","received_events_url":"https://api.github.com/users/jakearchibald/received_events","type":"User","site_admin":false},"created_at":"2015-08-10T10:42:53Z","updated_at":"2015-08-10T10:42:53Z","body":"Media elements, `<track>`, appcache and `importScripts` all fail to use body content if the status code looks like an error. `<link>`, `<object>`, `<script>` fails on 404, but it's not clear what they do with other error codes, but it seems like the intention is for them to consider other error codes to also be a failure.\r\n\r\nFeels like there's call for this to be part of fetch to standardise what's considered and error and what isn't."}}