Re: [fetch] Add option to automatically abort response stream if the data stopped arriving for longer than a specified time (#180)

I think the breakdown between this issue and #179 clarifies #20, but I think neither of them address the original aim of #20, which is to have an equivalent of xhr timeout.

I originally raised #20 with a far more naive understanding of the fetch & streaming APIs, but this is also the standpoint many developers will be coming to fetch from. 'If the content doesn't arrive in Nms, abort and show an error message' will still be a common/the commonest use case (perhaps not for developers strongly versed in SW, streams etc... but that *isn't* most developers)

With that in mind I'd prefer an API something like:

`opts.timeout` - timeout in miliseconds
`opts.timeoutType` - 'headers' (equivalent to #179), 'stream' (equivalent to this issue) or 'content' (which sets a timeout on `.json()` or `.text()`)

'content' would have no effect if .blob() is called. 'stream' would probably still have an effect if .text() or .json() are called, but it could also make sense for it to not do. Both 'stream' and 'content' would reject if headers do not return in time. I'm not sure which I would favour as the default, but probably 'content' as then the behaviour is more friendly for developers moving to fetch from xhr

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

Received on Monday, 29 February 2016 03:20:42 UTC