From 4de29779c708f7db4a6387003f7cc2aa78e6e4cc Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 5 May 2020 23:12:46 +0200 Subject: [PATCH] also abort timeout timer when response is rejected --- src/matrix/net/HomeServerApi.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/matrix/net/HomeServerApi.js b/src/matrix/net/HomeServerApi.js index 65deff2e..4ac7f9e2 100644 --- a/src/matrix/net/HomeServerApi.js +++ b/src/matrix/net/HomeServerApi.js @@ -78,7 +78,8 @@ export class HomeServerApi { () => {} // ignore AbortError ); // 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);