-
Notifications
You must be signed in to change notification settings - Fork 595
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
perf(util): improve isFormDataLike checks #1875
Conversation
Codecov ReportBase: 90.35% // Head: 90.33% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1875 +/- ##
==========================================
- Coverage 90.35% 90.33% -0.02%
==========================================
Files 70 70
Lines 6044 6044
==========================================
- Hits 5461 5460 -1
- Misses 583 584 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
lgtm
Can you add a test for the npm package form-data. An instance of that should not be formdata like |
Sure! I've installed the package onto |
This PR would implement #1872.
Context
Actually, the
FormData
class needs the following declaration to work:The
isFormDataLike
method was improved by checking theconstructor.name
and the declaration of those methods. This makes that control more strict and flexible. The check would be linear, there is no way to guess what API is requested by thechunk
. This check allows third-party libraries to be compatible with this control.Tests
The tests were updated by adding some cases where the check should return false or true.