Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: unsupported BodyInit type on some runtimes #530

Closed
Airkro opened this issue Sep 20, 2023 · 1 comment
Closed

Error: unsupported BodyInit type on some runtimes #530

Airkro opened this issue Sep 20, 2023 · 1 comment

Comments

@Airkro
Copy link

Airkro commented Sep 20, 2023

After import 'ky' (> 0.31.1), the Error: unsupported BodyInit type will block all code runs.

Since: v0.31.2

export const supportsStreams = (() => {
	let duplexAccessed = false;
	let hasContentType = false;
	const supportsReadableStream = typeof globalThis.ReadableStream === 'function';

	if (supportsReadableStream) {
		hasContentType = new globalThis.Request('', {
			body: new globalThis.ReadableStream(),                   //  <--- this error trigger error
			method: 'POST',
			get duplex() {
				duplexAccessed = true;
				return 'half';
			},
		}).headers.has('Content-Type');
	}

	return duplexAccessed && !hasContentType;
})();

Can we skip this step?

@sindresorhus
Copy link
Owner

What runtimes?

@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants