4

I am using node js with express framework, restful api. I want to post values using 'form-data' option in postman addon.

I am able to post values using the x-www-form-urlencoded option and am able to get values like req.body.username, req.body.email, etc. This is working fine, but I need 'form-data' option also.

If I use "form-data" option then I am not able to get the post values please help me how to get values using this option 'form-data' in postman addon.

Joe Clay
  • 33,401
  • 4
  • 85
  • 85
raj
  • 356
  • 1
  • 5
  • 20

2 Answers2

2

I just tried postman. It sends the header as content type multipart/form-data.

You need another package to handle that.

They are linked in body-parser repo at the top. For example: busboy, multiparty

Tobias Lins
  • 2,543
  • 19
  • 22
  • I have used this in my already var bodyParser = require('body-parser') app.use(bodyParser.urlencoded({ extended: false })) but i am still didn't get any response please help me app.post('/upload', function(req, res){ console.log(req.body); res.send( response); }); – raj Mar 25 '16 at 05:04
0

Use req.fields and use 'express-formidable' to get form-data from postman.