From aa37e27dc4a18127af7de885f9101aff96cab2e0 Mon Sep 17 00:00:00 2001 From: uzlopak Date: Fri, 12 Jul 2024 06:32:25 +0200 Subject: [PATCH] AbortSignal should result in a status code 0 --- src/fetch-wrapper.ts | 2 +- test/request.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fetch-wrapper.ts b/src/fetch-wrapper.ts index 313ebb947..6c621c0f0 100644 --- a/src/fetch-wrapper.ts +++ b/src/fetch-wrapper.ts @@ -49,7 +49,7 @@ export default async function fetchWrapper( let message = "Unknown Error"; if (error instanceof Error) { if (error.name === "AbortError") { - (error as RequestError).status = 500; + (error as RequestError).status = 0; throw error; } diff --git a/test/request.test.ts b/test/request.test.ts index 016e10fc3..99d3f2a5d 100644 --- a/test/request.test.ts +++ b/test/request.test.ts @@ -1009,7 +1009,7 @@ x//0u+zd/R/QRUzLOw4N72/Hu+UG6MNt5iDZFCtapRaKt6OvSBwy8w== } catch (error) { expect(error.name).toEqual("AbortError"); expect(error.message).toEqual("The operation was aborted."); - expect(error.status).toEqual(500); + expect(error.status).toEqual(0); } });