-
-
Notifications
You must be signed in to change notification settings - Fork 365
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
Conversation
source/core/constants.ts
Outdated
}, | ||
}).headers.has('Content-Type'); | ||
} catch { | ||
// IOS QQBrowser throw "unsupported BodyInit type" Error (see issue #581) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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'
?
There was a problem hiding this comment.
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. 🫰
Closes #581