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.
This commit is contained in:
Kir_Antipov 2024-01-04 11:09:21 +00:00
parent 577191382f
commit 4b559b054a

View file

@ -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;
}
}