mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
fetchWorker: preemptively throw if signal is aborted
This commit is contained in:
parent
ebbde66824
commit
576a66460f
1 changed files with 4 additions and 0 deletions
|
|
@ -27,6 +27,10 @@ const fetchWorker: typeof fetch = async (...args) => {
|
|||
const [url, init] = serializeFetchArgs(args);
|
||||
const { body, signal, ...rest } = init;
|
||||
|
||||
if (signal?.aborted) {
|
||||
throw new DOMException('The signal has been aborted', 'AbortError');
|
||||
}
|
||||
|
||||
const result = await client.fetch(url, { ...rest, body: await prepareBodyForWorker(body) }, signal);
|
||||
const response = new Response(...result);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue