also abort timeout timer when response is rejected

This commit is contained in:
Bruno Windels 2020-05-05 23:12:46 +02:00
parent 4ffaa82435
commit 4de29779c7

View File

@ -78,7 +78,8 @@ export class HomeServerApi {
() => {} // ignore AbortError () => {} // ignore AbortError
); );
// abort timeout if request finishes first // abort timeout if request finishes first
requestResult.response().then(() => timeout.abort()); const abort = () => timeout.abort();
requestResult.response().then(abort, abort);
} }
const wrapper = new RequestWrapper(method, url, requestResult); const wrapper = new RequestWrapper(method, url, requestResult);