From 00e45d02ab1ef0e04d7a6cf271b429cb6f946dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Fri, 17 Mar 2023 01:41:17 +0800 Subject: [PATCH] Fix compatibility with native Fetch being disabled on Node.js (#494) --- source/core/constants.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/core/constants.ts b/source/core/constants.ts index 62e28084..b3451240 100644 --- a/source/core/constants.ts +++ b/source/core/constants.ts @@ -5,8 +5,9 @@ export const supportsRequestStreams = (() => { let duplexAccessed = false; let hasContentType = false; const supportsReadableStream = typeof globalThis.ReadableStream === 'function'; + const supportsRequest = typeof globalThis.Request === 'function'; - if (supportsReadableStream) { + if (supportsReadableStream && supportsRequest) { hasContentType = new globalThis.Request('https://a.com', { body: new globalThis.ReadableStream(), method: 'POST',