# Sending request with form-data failed! it send an empty object!

**URL:** <https://community.postman.com/t/sending-request-with-form-data-failed-it-send-an-empty-object/30414>\
**Category:** Help Hub\
**Tags:** form-data\
**Created:** [December 6, 2021, 11:01am UTC](https://community.postman.com/t/sending-request-with-form-data-failed-it-send-an-empty-object/30414 "2021-12-06T11:01:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohamedanouarjabri](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@mohamedanouarjabri](https://community.postman.com/u/mohamedanouarjabri)\
**Post date:** [December 6, 2021, 11:01am UTC](https://community.postman.com/t/sending-request-with-form-data-failed-it-send-an-empty-object/30414/1 "2021-12-06T11:01:42Z")

</div>

Hello community,  
I need help solving this problem .

 ![Capture d’écran (63)](https://us1.discourse-cdn.com/getpostman/original/2X/6/68d17daf9d8dbccef84f6d2005be680fca399efd.png)

in this image sending a request is totally normal and I have my data stored in req.body as usual.

 ![Capture d’écran (64)](https://us1.discourse-cdn.com/getpostman/original/2X/1/19d536cf77234e9c3c21526279c634feedb067eb.png)  
 ![Capture d’écran (65)_LI](https://us1.discourse-cdn.com/getpostman/original/2X/6/648e90f5cdf9aa65644dabc4b0f7ef42b5fb8b62.jpeg)

but here when I try to do the same thing with a form-data type, there is no data in the req.body, it’s an empty object. I don’t know why.  
thank you for helping me

---

<div class="post-metadata">

**Author:** ![bbahadur](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bbahadur](https://community.postman.com/u/bbahadur)\
**Post date:** [December 6, 2021, 12:25pm UTC](https://community.postman.com/t/sending-request-with-form-data-failed-it-send-an-empty-object/30414/2 "2021-12-06T12:25:41Z")

</div>

Hey @mohamedanouarjabri, Welcome to the community! 🥳

Depending on your API, for form data you try to check for form object in the request.  
Try something like this in your Pre-request Script tab:

```auto
var req=pm.request.body;
console.log(req.formdata)

```

Good luck!

---

<div class="post-metadata">

**Author:** ![mohamedanouarjabri](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@mohamedanouarjabri](https://community.postman.com/u/mohamedanouarjabri)\
**Post date:** [December 6, 2021, 12:32pm UTC](https://community.postman.com/t/sending-request-with-form-data-failed-it-send-an-empty-object/30414/3 "2021-12-06T12:32:14Z")

</div>

Thank you friend!  
but what is “pm”?

---

<div class="post-metadata">

**Author:** ![bbahadur](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bbahadur](https://community.postman.com/u/bbahadur)\
**Post date:** [December 6, 2021, 12:35pm UTC](https://community.postman.com/t/sending-request-with-form-data-failed-it-send-an-empty-object/30414/4 "2021-12-06T12:35:13Z")

</div>

It’s Postman’s sandbox object.  
Learn more about it here :[https://learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/](https://learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/)

---

<div class="post-metadata">

**Author:** ![mohamedanouarjabri](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@mohamedanouarjabri](https://community.postman.com/u/mohamedanouarjabri)\
**Post date:** [December 6, 2021, 12:45pm UTC](https://community.postman.com/t/sending-request-with-form-data-failed-it-send-an-empty-object/30414/5 "2021-12-06T12:45:00Z")

</div>

where should I write this??

---

<div class="post-metadata">

**Author:** ![mikeytroo](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@mikeytroo](https://community.postman.com/u/mikeytroo)\
**Post date:** [April 3, 2022, 5:27pm UTC](https://community.postman.com/t/sending-request-with-form-data-failed-it-send-an-empty-object/30414/6 "2022-04-03T17:27:58Z")

</div>

I hope you figured it out.  
The reason why is this because your presumed express server doesn’t parse multipart/form-data.  
For it to parse this data you need to use something like multer.

So install multer, then in your main server file simple add the following.

```auto
const multer = require("multer");
const upload = multer();
// Add multer middleware for parsing multipart/form-data
router.post('test',upload.none(),(req,res,next)=>{
console.log(req.body);
});

```

This will attach multer middleware which will then parse your text multipart/form-data and reattach it to req.body which should now hold you desired data.
