Skip to content
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

feat: add helper to parse multipart/form-data #280

Merged
merged 7 commits into from
Dec 15, 2022
Merged

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

resolves #43

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This adds a utility to read multipart/form-data: readMultipartFormData. It's a separate utility so it doesn't add to the bundle size if not used, as it uses parse-multipart-data to handle the parsing.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe added the enhancement New feature or request label Dec 13, 2022
@danielroe danielroe requested a review from pi0 December 13, 2022 14:02
@danielroe danielroe self-assigned this Dec 13, 2022
@pi0
Copy link
Member

pi0 commented Dec 13, 2022

Used library seems a fork and no esm exports. It would be nice if we can inline and cleanup implementation (author shall be be preserved in same file)

@pi0
Copy link
Member

pi0 commented Dec 13, 2022

Can we name it readFormBody or readMultipartBody for naming consistency?

@danielroe
Copy link
Member Author

Shall we just open a PR to add esm exports upstream?

@pi0
Copy link
Member

pi0 commented Dec 13, 2022

I prefer inlining for easier future enhancenments. It is same for other utils.

Copy link
Member Author

It just seems less maintainable, that's all, as there's already someone actively maintaining it. But if you wish.

@codecov
Copy link

codecov bot commented Dec 13, 2022

Codecov Report

Merging #280 (848ba23) into main (c8b4d85) will increase coverage by 1.48%.
The diff coverage is 91.48%.

@@            Coverage Diff             @@
##             main     #280      +/-   ##
==========================================
+ Coverage   74.36%   75.84%   +1.48%     
==========================================
  Files          20       21       +1     
  Lines        1541     1681     +140     
  Branches      240      273      +33     
==========================================
+ Hits         1146     1275     +129     
- Misses        395      406      +11     
Impacted Files Coverage Ξ”
src/utils/body.ts 83.47% <66.66%> (-2.11%) ⬇️
src/utils/multipart.ts 95.12% <95.12%> (ΓΈ)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@danielroe danielroe requested review from pi0 and removed request for pi0 December 13, 2022 22:01
@pi0
Copy link
Member

pi0 commented Dec 15, 2022

Reverted the utility name back to readMultipartFormData it was making sense. Also pushed several improvements and bug fixes for ported implementation.

@pi0 pi0 merged commit 4e52381 into main Dec 15, 2022
@pi0 pi0 deleted the feat/multipart-form-data branch December 15, 2022 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accept File upload!
2 participants