-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
saveRequestFiles
is consuming value fields and give no way to retreive them if there were no files
#549
Comments
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
@mcollina I may implement it, but do you agree with proposed solution (adding Another non-breaking solution would be to add another function like saveRequestedFiles, that would return the list of saved files and value fields separately. But there are many functions already (parts(), files(), file(), etc), which is already confusing so i would not do that. Yet another non breaking solution is to add an param to Do you have any idea maybe? |
I think we can change this to: const { files, values } = await req.saveRequestFiles(); |
Are you fine with breaking changes? |
Yes, it seems we forgot about values in the design of that API. |
hmm... that means no backport for me, as i'm using a version 6.x so it's compatible with fastify 3.x |
@dzek69 well, that's well out of support anyway, there would never be a backport for fastify 3.x. |
Prerequisites
Fastify version
3.20.x
Plugin version
6.0.1
Node.js version
21.7.1
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Alpine 3.15 I think
Description
I have a endpoint, where I process optional files. I really like the convenience of
saveRequestFiles
, but there is one problem - if there were no files - there is no way to access fields (I don't want to useattachFieldsToBody
btw) - they are already consumed.I know I can still do stuff manually, but maybe there is a way to improve
saveRequestFiles
somehow? Even "dumb" stuff like attaching extrafields
property directly to an array returned bysaveRequestFiles()
would be nice (that would be non-breaking change)Link to code that reproduces the bug
No response
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: