【问题标题】:Node JS request module does not send form dataNode JS请求模块不发送表单数据
【发布时间】:2018-09-11 22:58:06
【问题描述】:

我正在使用节点 js 中的“请求”模块发出发布请求,如下所示:

 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;
});

没有服务器端我收到请求,但是参数不来。我做错了什么?

【问题讨论】:

  • 你在网络标签中得到了什么?
  • 我不是通过浏览器做的

标签: node.js express post request


【解决方案1】:

我认为您必须对表单数据进行字符串化并将其放入正文中。以下是已回答的类似问题:POST Requests not working using request module in node.js

【讨论】:

    猜你喜欢
    • 2012-04-03
    • 1970-01-01
    • 1970-01-01
    • 2018-12-25
    • 2018-04-26
    • 2013-07-07
    • 2021-05-08
    • 1970-01-01
    • 2020-06-05
    相关资源
    最近更新 更多