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 use attachFieldsToBody btw) - they are already consumed.
// this prints "start" and "end" only
const files = await req.saveRequestFiles();
// `files` is an empty array
console.log("start");
for await (const part of parts) {
console.log(part);
}
console.log("end");
I know I can still do stuff manually, but maybe there is a way to improve saveRequestFiles somehow? Even "dumb" stuff like attaching extra fields property directly to an array returned by saveRequestFiles() would be nice (that would be non-breaking change)
Link to code that reproduces the bug
No response
Expected Behavior
No response
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 useattachFieldsToBodybtw) - they are already consumed.I know I can still do stuff manually, but maybe there is a way to improve
saveRequestFilessomehow? Even "dumb" stuff like attaching extrafieldsproperty 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