fetch icon indicating copy to clipboard operation
fetch copied to clipboard

Making requests with timeout

Open johtso opened this issue 8 months ago • 7 comments

Specifying a timeout when making a web request seems like a core feature, otherwise your code is at the whim of whatever you're communicating with.

Usually I'd pass a AbortSignal.timeout(time) in the fetch options.

Another solution would be to race the promise with setTimeout. Doesn't look like the promises package exposed race functionality though.

Possibly linked with #4.. depending on the approach

Related: https://github.com/gleam-lang/javascript/issues/11 https://github.com/gleam-lang/javascript/issues/10

johtso avatar Jun 10 '24 09:06 johtso