- From: Karl Horky <notifications@github.com>
- Date: Sat, 12 Oct 2019 10:01:16 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 12 October 2019 17:01:20 UTC
> XHR completes when the body is received. fetch completes when the headers are received. They're not the same thing.
@Pauan Then maybe the timeout for `fetch` should take this into account? Adding one more property to @ianstormtaylor's proposal could be a possible solution, no?
```js
fetch(url, {
timeout: 5000,
timeoutIncludesBody: true, // default: false
})
```
Defaulting this to `false` is so that the default behavior of `fetch` (to complete when the headers are received) is respected. This is to provide the least surprising API when one knows how `fetch` works.
I don't think that the solution to "keep this in userland" is great here, because this is a very common use case for non-trivial apps. It should be built into the platform.
--
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/20#issuecomment-541342956
Received on Saturday, 12 October 2019 17:01:20 UTC