Skip to content

Can't make the multipart work with koa-router #41

@vhpoet

Description

@vhpoet

I'm on koa@2.2.0, koa-router@7.2.0 and koa-better-body@3.0.2.

Trying to disable multipart for all the routes except /profilepic.

app.use(body({
  multipart: false,
  strict: false
}))
router.post('/profilepic',
  body({
    multipart: true,
    uploadDir: path.resolve(__dirname, '../../../uploads')
  }),
  this.changeProfilePicture
)

with this code changeProfilePicture is never called. It works if I remove the body() from the router and use multipart: true on app.use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pkg: koa-better-bodyPriority: MediumThis issue may be useful, and needs some attention.Status: AcceptedIt's clear what the subject of the issue is about, and what the resolution should be.Status: BlockedAnother issue needs to be resolved first or an external blocker.Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions