Skip to content

ContentType: text/plain not showing in fields #875

Open
@neronim1141

Description

@neronim1141

Support plan

  • Which support plan is this issue covered by? Community
  • Currently blocking your project/work? yes
  • Affecting a production system? yes

Context

  • Node.js version: 16.13.1
  • Release Line of Formidable (Legacy, Current, Next): Next
  • Formidable exact version: 3.2.4
  • Environment (node, browser, native, OS): node
  • Used with (popular names of modules): nextjs, next-connect

What are you trying to achieve or the steps to reproduce?

Im trying to make custom server functionality on nextjs api route,
where i get some request data from game as "multipart/form-data;"
but some of the data has "text/plain" content type.

router.post(async (req, res) => {

  const form = new IncomingForm();
  form.parse(req, (err, fields, files) => {
    console.log(fields);
    console.log(files);
  });

  res.end();
});

export const config = {
  api: {
    bodyParser: false,
  },
};

What was the result you got?

Only the files variable gets populated.
As i needed to disable parser for nextjs
i cant really use req.body.
looping for 'text/plain' mimetype in files and parsing them manualy is not desired either

What result did you expect?

'text/plain' content type parsed into fields variable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions