- From: Arthur Stolyar <notifications@github.com>
- Date: Fri, 27 Mar 2015 08:32:59 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
Received on Friday, 27 March 2015 15:33:42 UTC
@jakearchibald what is wrong with this way?
```javascript
var req = fetch('...');
// or req.headers.then(...)
req.response.then(function(response) {
if (response.headers.get('Content-Type') !== 'aplication/json') {
req.cancel();
}
return response.json();
});
req.addEventListener('cancel', function() {
// ...
});
// or Streams-style way
// closed/cancelled/aborted
req.closed.then(function() {
// ...
});
```
Here ```fetch``` will return some FetchObject, not Promise itself.
---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/27#issuecomment-86976037
Received on Friday, 27 March 2015 15:33:42 UTC