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

pass field directly for files #473

Closed
wants to merge 7 commits into from
Closed

Conversation

gurgunday
Copy link
Member

@gurgunday gurgunday commented Aug 17, 2023

Closes #472

Instead of monkey patching request.file() and making it return already consumed file fields, we can just pass them directly to req.body when attachFieldsToBody is set to 'keyValues'

Initially, this PR only passed _buf and filename, but if someone needs to see the file name, they might also want to see the mimetype or other properties, so we now just pass the entire field for files

Checklist

@Uzlopak
Copy link
Contributor

Uzlopak commented Aug 17, 2023

Sounds semver major

@gurgunday
Copy link
Member Author

Yeah, I pointed it at next

@gurgunday
Copy link
Member Author

This also lets people use the registered schema to validate file properties, which otherwise is redundant for attachFieldsToBody: 'keyValues'

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@gurgunday
Copy link
Member Author

This PR will be superseded

@gurgunday gurgunday closed this Sep 1, 2023
@ryanrishi
Copy link

@gurgunday was this PR ever superseded by another PR? I'm looking to get both the filename and contents while using attachFieldsToBody: 'keyValues', so this change would still be very helpful.

@sourabh-goyal-kasitech
Copy link

is this available now?

@gurgunday gurgunday deleted the next-field branch July 9, 2024 08:40
@gurgunday gurgunday restored the next-field branch July 9, 2024 08:40
@gurgunday
Copy link
Member Author

Hey, this is still not available

Feel free to send a PR to next — you can just pass the file field instead of calling toBuffer like in this PR

I'm trying to write a performant multipart/form-data parser currently

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

Successfully merging this pull request may close these issues.

5 participants