-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Support for saveRequestFiles with attachFieldsToBody set true #409
Conversation
Why does it only partially address #313? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Because the typescript problem described couldn't be reproduced, and in case of custom |
Could you throw a proper error if this is the case? |
index.js
Outdated
filename, | ||
encoding, | ||
mimetype, | ||
limit: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this change relevant?
index.js
Outdated
next(err) | ||
}, | ||
options | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this change relevant? Seems just linting
index.js
Outdated
}) | ||
file.on('limit', () => { | ||
lastFile.limit = true | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this change relevant?
index.js
Outdated
if ( | ||
options.attachFieldsToBody === true || | ||
options.attachFieldsToBody === 'keyValues' | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this change relevant?
index.js
Outdated
'FST_FILE_BUFFER_NOT_FOUND', | ||
'the file buffer was not found', | ||
500 | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this change relevant? Seems just linting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, linter went crazy, I think they're all solved now
index.js
Outdated
@@ -528,6 +535,29 @@ function fastifyMultipart (fastify, options, done) { | |||
return requestFiles | |||
} | |||
|
|||
async function * filesFromFields (container) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why async generator but not a generator?
It doesn't really need to be async.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already changed
It seems I can only re-request one review @mcollina @climba03003 @StarpTech, sorry for the inconvenience |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Added files async files generator function to
saveRequestFiles
which fetches files from body instead of fromgetMultipartFiles
when `attachFieldsToBody is set to truePartially addresses #313
Checklist
npm run test
andnpm run benchmark
and the Code of conduct