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

> Since calling abort might not abort the fetch (request)

If you call it on the promise returned by `fetch()` it will abort the request, but it won't abort the response. Unless of course the request is complete.

Your example will fail because you have two consumers of the same stream, we reject in this case. It should be:

```js
var fetchPromise = fetch(url);
var jsonPromise = request.then(r => r.clone().json());
var textPromise = request.then(r => r.text());
textPromise.abort();
```

In this case, `textPromise.abort()` cancels the reading of the stream, but wouldn't abort the fetch because there are other uncancelled children. If for some reason the json completed earlier, the raw response would be buffered in memory to allow the other read. Aborting the text read would free up this buffer.

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

Received on Thursday, 26 March 2015 14:12:16 UTC