fetch
fetch copied to clipboard
Making requests with timeout
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