Trying to send form data but i'm getting req.body as undefined

Describe the bug
I am trying to send form data to my API but req.body is undefined for some reason.

To Reproduce
Steps to reproduce the behavior:

  1. create a new request
  2. enter your API endpoint URL
  3. select the body tab and then select the form-data tab
  4. enter the key name of the form data you are trying to send so your API can recognize it and then the value.
  5. Click send and you should get a response with a status code of 200. If you get an error like me telling me that req.body is undefined then you have the same problem as me.

Expected behavior
I expect my API route handler function to create a new product for my ecommerce site. But instead I get an error coming from my ORM which is Sequelize. Telling me that name cannot be null because I am trying to add it to the database table. I even console.logged it on my server (im using node.js) and it req.body really is undefined.

Screenshots

Here is another picture that is showing that req.body is actually empty. I console.logged it:


App information (please complete the following information):

  • Ecommerce API (Node.js)
  • Postman Version 7.2.1
  • OS: Windows

Additional context
If you have any other question or I am forgetting something to show you guys, just let me know.

Yeah that looks frustrating @asaadullamikabir :frowning:

Welcome to the Postman community though! :+1:

You’ll have to put on your detective hat on to track down how to make it work.

You could open the Postman console
image
and run the request again. Then check how the request looks there ( try both the pretty and raw views)
That would verify if Postman thinks it’s sending the form data.

Also, is there a system that currently makes the call (web UI, mobile app etc) that you could capture using something like the browser dev tools, Fiddler or CharlesProxy etc? Then double check if you’re doing exactly the same thing in your Postman request.

I notice that the error response in your screenshot reports that Product.name cannot be null, have you tried changing the key to exactly that?