-
Notifications
You must be signed in to change notification settings - Fork 529
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
More strict isFormDataLike #1872
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
Hey @ronag, what about the following check? function isFormDataLike (chunk) {
return (
(chunk &&
chunk.constructor && chunk.constructor.name === 'FormData' &&
/^(FormData)$/.test(chunk[Symbol.toStringTag])
)
)
} Could this control be sufficient in your opinion? It checks if the instance of |
I'm not sure that is sufficient |
That has the problem in the other direction. Third party module that are FormData like might not work. I think it's best to check constructor.name and make sure the expected API is available on the instance. |
isFormDataLike
currently only checks that theconstructor.name
is'FormData'
. We should also check the interface as there are npm packages that have the correct name but wrong interface causing confusion where it's read as a FOrmData instead of a async generator..The text was updated successfully, but these errors were encountered: