feat: Add multipart/form-data support for file uploads#3634
Merged
feat: Add multipart/form-data support for file uploads#3634
Conversation
Deploying feathers-dove with
|
| Latest commit: |
bc5c4f5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://17fa6525.feathers.pages.dev |
| Branch Preview URL: | https://v6-form-data.feathers.pages.dev |
Deploying feathers-eagle with
|
| Latest commit: |
bc5c4f5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2a0e091a.feathers-a8l.pages.dev |
| Branch Preview URL: | https://v6-form-data.feathers-a8l.pages.dev |
ca5e0ec to
dd66346
Compare
- Auto-detect FormData in fetch client and skip JSON serialization - Parse multipart/form-data in server bodyParser middleware - Convert FormData to plain object (single values unwrapped, multiple become arrays) - Replace @whatwg-node/server with native Node.js adapter for proper FormData handling - Add tests for FormData handling in client and server - Update REST client docs with FormData and file upload section
dd66346 to
bc5c4f5
Compare
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds native FormData and file upload support to the Feathers HTTP transport.
Changes
Client (
packages/feathers/src/client/fetch.ts)FormDatain request body and skips JSON serializationContent-Typeheader with multipart boundaryServer (
packages/feathers/src/http/middleware.ts)multipart/form-dataparsing inbodyParser()using nativerequest.formData()Test Fixture (
packages/feathers/fixtures/index.ts)@whatwg-node/serverwith a native Node.js adapterUsage
Limitations
request.formData()which buffers into memory. For large files, use presigned URLs to upload directly to cloud storage.Breaking Changes
None. This is additive functionality.