- From: Robert Nagy <notifications@github.com>
 - Date: Mon, 09 Aug 2021 07:24:32 -0700
 - To: whatwg/fetch <fetch@noreply.github.com>
 - Cc: Subscribed <subscribed@noreply.github.com>
 
Received on Monday, 9 August 2021 14:24:44 UTC
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