Skip to content

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

Merged
pi0 merged 7 commits intomainfrom
feat/multipart-form-data
Dec 15, 2022
Merged

feat: add helper to parse multipart/form-data#280
pi0 merged 7 commits intomainfrom
feat/multipart-form-data

Conversation

@danielroe
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

pi0 commented Dec 13, 2022

Can we name it readFormBody or readMultipartBody for naming consistency?

@danielroe
Copy link
Copy Markdown
Member Author

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

@pi0
Copy link
Copy Markdown
Member

pi0 commented Dec 13, 2022

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

@danielroe
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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.

Comment thread src/utils/multipart.ts Outdated
@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