Re: [fetch] Aborting a fetch (#27)

OK I'd like to come back with something I didn't know.

In the XMLHttpRequest page from WHATWG [there is a way to abort fetch](https://xhr.spec.whatwg.org/#terminate-the-request).

Fetch is indeed used in the third step of `.send()` (which is point 11) so at this point I really wonder if the proposal made by Arthur Stolyar would solve this problem and make everyone (but @martinthomson ) happy.

Arthur mentioned this:

```js
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);

// a stream type
// responseType already specd
xhr.responseType = 'stream';

// the way to retrieve the stream
// onloadstart already specd
xhr.onloadstart = function() {
  var reader = xhr.response.getReader();
  // ... 
};

xhr.onerror = function() {
  console.log("Booo");
};

xhr.send();
```

Basically everything is already specd and apparently as it is all Fetch happens behind the scene and the UA has the ability to drop everything through an internal fatal (... eww ...)

The only difference using a stream is that accessing response should also return an empty string or even throw an error.

This would be the easiest thing to move the web forward with Streams and upgrade to Level 3 XHR

Is this an option? If not, why exactly? It seems easy for everyone, fetch can still be proposed for less powerful interaction or Promisish ok/err client/server interactions.



---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/27#issuecomment-86732523

Received on Thursday, 26 March 2015 21:59:37 UTC