Skip to content

Implement FormData.set method and handle Blob instances #30767

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

Closed

Conversation

acostalima
Copy link

@acostalima acostalima commented Jan 20, 2021

Summary

The proposed changes brings FormData's implementation one step closer to spec compliance by:

  • Implementing .set method.
  • Adding support to filename argument on both .set and .append for Blob and File values.
  • Handling Blob instances in .getParts instead of just blob-like objects with the uri property.

Additionally, I've took the opportunity to improve FormDatas test suite overall by adding more test cases.

It's worth noting that according to the implementation of URL.createObjectURL, the call may fail if the native blob module is not available. However, I don't know which circumstances determine its availability:

  • Is it the native platform?
  • Is it the React Native version?

Changelog

[JavaScript] [Added] - Implement FormData.set.
[JavaScript] [Added] - Add support to filename argument on both FormData.set and FormData.append for Blob and File values.

Test Plan

Run the following command at the root of React Native's directory:

npm t -- FormData-test.js

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 20, 2021
@acostalima acostalima force-pushed the implement-formdata-set-method branch from 8fc7644 to 77e6ec2 Compare January 20, 2021 12:43
@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 6079256

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,899,112 -747
android hermes armeabi-v7a 8,403,206 -720
android hermes x86 9,385,650 -1,127
android hermes x86_64 9,331,050 -1,310
android jsc arm64-v8a 10,350,615 -1,067
android jsc armeabi-v7a 9,837,813 -1,035
android jsc x86 10,398,663 -1,436
android jsc x86_64 10,984,315 -1,623

Base commit: 6079256

@hugomrdias
Copy link

Any chance we can get some feedback with this ?

@react-native-bot react-native-bot added the Type: Enhancement A new feature or enhancement of an existing feature. label Oct 1, 2021
@github-actions
Copy link

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 22, 2023
@github-actions
Copy link

This PR was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Stale There has been a lack of activity on this issue and it may be closed soon. Type: Enhancement A new feature or enhancement of an existing feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants