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

Improve detection of streaming request support (#581) #582

Merged
merged 3 commits into from
Jun 25, 2024

Conversation

edram
Copy link
Contributor

@edram edram commented Apr 25, 2024

Closes #581

},
}).headers.has('Content-Type');
} catch {
// IOS QQBrowser throw "unsupported BodyInit type" Error (see issue #581)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but we cannot silently ignore all errors from the Request constructor. There are many genuine, useful errors that it can potentially throw. Maybe you could explain what you are trying to accomplish (I couldn't understand from the linked issue). If you think we should be ignoring a particular error in certain circumstances, then we will need to properly detect those conditions and the specific error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my understanding, this code is supposed to determine whether the runtime supports streaming requests. However, the code above throws Error: unsupported BodyInit type in the QQ app or QQ browser on iOS. This indicates that these two runtimes do not support streaming requests. The check for support should not throw an error. Given the large number of QQ users, the latest version of ky in my project can use is version 0.31.1.

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, thanks. I understand now. I have reopened the PR. Can you please update your code so it re-throws the error if error.message !== 'unsupported BodyInit type'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your response. I have updated my code. 🫰

@sholladay sholladay changed the title Fix unsupported BodyInit type (#581) Improve detection of streaming request support (#581) Jun 25, 2024
@sholladay sholladay merged commit b1effd9 into sindresorhus:main Jun 25, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

Error: unsupported BodyInit type
2 participants