From 4b559b054a7382b464288d06f8a75299641cc0f9 Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Thu, 4 Jan 2024 11:09:21 +0000 Subject: [PATCH] Fixed `HttpResponseOptions` being ignored The problem here is that the spread operator doesn't work with getters. Thus, if an instance implementing the `HttpResponseOptions` interface with getters instead of regular readonly fields is supplied to the method, it won't function as expected, even though TypeScript's static typing indicates that everything should be fine. --- src/utils/net/http-response.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/net/http-response.ts b/src/utils/net/http-response.ts index 8286ebf..e5109c5 100644 --- a/src/utils/net/http-response.ts +++ b/src/utils/net/http-response.ts @@ -213,7 +213,7 @@ export class HttpResponse { headers.set("Content-Type", contentType); } - return new Response(data, { ...options, headers }) as NodeFetchResponse; + return new Response(data, { status: options?.status, statusText: options?.statusText, headers }) as NodeFetchResponse; } }