node-restify
node-restify copied to clipboard
Inject the formidable "form" to the "multipartHandler" and "multipartFileHandler" functions
Pre-Submission Checklist
- [x] Opened an issue discussing these changes before opening the PR
- [x] Ran the linter and tests via
make prepush - [x] Included comprehensive and convincing tests for changes
Issues
Closes:
- Issue #1870
Having access to the formidable form in the multipartHandler and multipartFileHandler is crucial to handle the request and incoming form easily.
Changes
In this pull request, the only change is the injection of formidable form to the multipartHandler and multipartFileHandler functions as the third argument.
This give us the ability to call form.handlePart(part) inside the customized functions. It's useful when the user wants to restrict input files to some extensions e.g. png/jpg/jpeg etc. As a result, when the part.mime would be acceptable, the user can continue the process by calling form.handlePart(part).