- From: Timothy Gu <notifications@github.com>
- Date: Mon, 08 Jan 2018 00:44:45 +0000 (UTC)
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/issues/657/355866902@github.com>
Seems like the relevant spec section is this: > [HTTP-network fetch](https://fetch.spec.whatwg.org/#concept-http-network-fetch) > > 12. Run these substeps in parallel: > > 1. … > > 1. If one or more bytes have been transmitted from *response*’s message body, then: > > 4. Set *bytes* to the result of [handling content codings](https://fetch.spec.whatwg.org/#handle-content-codings) given *codings* and *bytes*. > > 5. Enqueue a `Uint8Array` object wrapping an `ArrayBuffer` containing bytes to stream. If that threw an exception, terminate the ongoing fetch, and error stream with that exception. > > 2. Otherwise, if the bytes transmission for *response*’s message body is done normally and *stream* is readable, then close stream and abort these in-parallel steps. > > 2. … > > 3. … > > 4. Otherwise, if [the fetch has not been aborted and] *stream* is readable, error stream with a `TypeError`. I guess there are a few things of interest here: 1. the algorithm is treating “[handling content codings](https://fetch.spec.whatwg.org/#handle-content-codings)” will always succeed, which is not the case in practice 2. any TCP/TLS transmission errors are not accounted for, which may be because of the following TODO > The exact layering between Fetch and HTTP still needs to be sorted through and therefore *response* represents both a response and an HTTP response here. On the other hand, we could reasonably at least specify the exact error type to throw in case of such transmission errors. The error handling of the specific body consumption methods (`text()`, `json()`, etc.) seem to be pretty solid through the ReadableStream’s error mechanism (see “[read all bytes](https://fetch.spec.whatwg.org/#concept-read-all-bytes-from-readablestream)” which those methods call upon through “[consume body](https://fetch.spec.whatwg.org/#concept-body-consume-body)”). -- 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/657#issuecomment-355866902
Received on Monday, 8 January 2018 00:45:09 UTC