Skip to content

Commit

Permalink
fix body only has file key
Browse files Browse the repository at this point in the history
  • Loading branch information
huangang committed Aug 7, 2019
1 parent 7ca7da5 commit d76ed5d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function fastifyUpload (fastify, options, done) {

fastify.addHook('preValidation', (request, reply, done) => {
if (request.raw && request.raw.files) {
!request.body && (request.body = {})
!request.body && (request.body = request.raw.body || {})
for (const key in request.raw.files) {
request.body[key] = request.raw.files[key]
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fastify-file-upload",
"version": "2.0.0",
"version": "2.0.1",
"description": "file upload plugin for Fastify",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit d76ed5d

Please sign in to comment.