2

I am making a post request using "request" module in node js like this:

 request.post({url: 'http://localhost:4004/api/v1/notifications/post', form: {msg:msg, userID:userID}}, function(err, httpResponse, body){
    if(err) return 0;
    else return 1;
});

no the server side I get the request, however the parameters do not come. What am I doing wrong?

2
  • what do you get in the network tab ? Commented Apr 2, 2018 at 17:52
  • I do not do it through browser Commented Apr 2, 2018 at 18:04

1 Answer 1

2

I think you have to stringify your form data and put it in the body. Here is a similar question that has been answered: POST Requests not working using request module in node.js

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.