formidable: ContentType: text/plain not showing in fields
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
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 2
- Comments: 16 (6 by maintainers)
Workaround tested on v2:
if mimetype is text/plain it should be decoded into fields instead of file with provided charset, unless explicity specified, or allow us to exclude fields from converting to files
Do you suggest to change formidable ?
If I understand correctly you want to access files sent as text/plain as if it was another field ?