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(express): add support for multer.none #11667

Merged
merged 1 commit into from Jun 12, 2023

Conversation

mathewtrivett
Copy link
Contributor

@mathewtrivett mathewtrivett commented May 25, 2023

Adds an interceptor for multer's none option https://github.com/expressjs/multer#none. This allows for Nest.js users to process multipart/form-data that does not include any files.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

I am implementing a feature that uses the Sendgrid Inbound Parse API. This sends the data encoded as multipart/form-data however the payload includes no files. I believe all data are sent as strings/text.

I reached for the Nest.js MulterModule but it currently does not support multer's none option. multer.none parses only the text fields in the body and raises an exception if any files are submitted.

What is the new behavior?

This PR adds a new NoFilesInterceptor and associated tests. This would allow MulterModule users to accept multipart/form-data without any files.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

There is a separate but related PR in the docs project nestjs/docs.nestjs.com#2747.

Also, if there is a way to natively handle text only multipart/form-data without the MulterModule would be great to know about that.

@coveralls
Copy link

coveralls commented May 25, 2023

Pull Request Test Coverage Report for Build 90f15255-9556-4330-a372-5f345920a7ae

  • 17 of 17 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 92.652%

Totals Coverage Status
Change from base Build ca6b0cd6-9a68-4f95-9278-bca8f4b87731: 0.02%
Covered Lines: 6544
Relevant Lines: 7063

💛 - Coveralls

Adds an interceptor for multer's none option https://github.com/expressjs/multer#none. This allows for Nest.js users to process
`multipart/form-data` that does not include any files.
@mathewtrivett
Copy link
Contributor Author

@kamilmysliwiec apologies to @ you but I couldn't see another way to request a review by maintainers. Do you have any thoughts on this PR and the associated docs PR? Appreciate your time.

@kamilmysliwiec kamilmysliwiec merged commit 86e4ea4 into nestjs:master Jun 12, 2023
3 checks passed
@kamilmysliwiec
Copy link
Member

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants