Re: [whatwg/fetch] Add a `timeout` option, to prevent hanging (#951)

Agree that it should be in the userland, it's like you said

> To be clear, I'm not saying that this timeout option handles every single need for timeouts under the sun. That's impossible.

AbortController can

> This is something that needs to happen for pretty much every fetch call in an application, or you leave yourself open to infinite hanging bugs.

If you want it to apply to **every** request then you should look into using service worker and modify each request (acting a bit as a MITM).
Then you can control more then just ajax calls. You can then handle styles, images and other assets too

Or make this implementation yourself in a mini-lib like @domenic mention. 

most ppl basically wrap fetch in there own http-client since they need to inject some authentication  in each request, then you could as well create a abort controller if they pass in a timeout option

-- 
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/951#issuecomment-541429926

Received on Sunday, 13 October 2019 15:45:46 UTC