Skip to content

Commit

Permalink
Fix compatibility with native Fetch being disabled on Node.js (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Mar 16, 2023
1 parent 719e549 commit 00e45d0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/core/constants.ts
Expand Up @@ -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',
Expand Down

0 comments on commit 00e45d0

Please sign in to comment.