[whatwg/fetch] cancelling fetch after promise has been resolved (#1282)

Given my current understand of the spec the following unit test will always fail:

```
      it('should reject response body methods immediately with AbortError when aborted before stream is disturbed', () => {
        return expect(fetch(
          `${base}slow`,
          { signal: controller.signal }
        ))
          .to.eventually.be.fulfilled
          .then(res => {
            controller.abort()
            return expect(res.text())
              .to.eventually.be.rejected
              .and.be.an.instanceof(Error)
              .and.have.property('name', 'AbortError')
          })
      })
```

The response is cancelled before `res.text()` starts reading from the response body and given the current way `ReadableStream.cancel` works we will just read an empty string as success.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1282

Received on Monday, 9 August 2021 14:24:44 UTC