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

Clearing up a question from IRC:

```js
var fetchPromise = fetch(url).then(response => {
  // noooope:
  fetchPromise.abort();
  var jsonPromise = response.json().then(data => console.log(data));
});
```

In the above, `fetchPromise.abort()` does nothing as the promise has already settled. The correct way to write this would be:

```js
var jsonPromise = fetch(url).then(r => r.json());
```

Now `jsonPromise.abort()` would cancel either the request, or the response, whichever is in progress.

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

Received on Thursday, 26 March 2015 12:28:18 UTC