【问题标题】:Curl POST with data and Node server with Express带有数据的卷曲 POST 和带有 Express 的节点服务器
【发布时间】:2017-08-14 20:41:53
【问题描述】:

我正在针对 AppleScript 请求发送 curl POST 请求。它发送带有以下文本的数据:“house,dog,plant”。但是,在我的节点服务器上,我刚刚读到:“house”

知道为什么吗?谢谢!

Applescript:

set testText to "house,dog,plant"

        do shell script "curl -X POST -d words=" & testText & " http://localhost:3000/comments"

带有 Express 的节点服务器:

exports.getSlideComments = function(req, res) {

console.log("ENTERED POST");

console.log (req.body.words); // It just prints house

res.send('200');

};

【问题讨论】:

标签: node.js curl post applescript


【解决方案1】:

这是因为您的 Node 程序希望数据是 application/x-www-form-urlencoded。

尝试使用%2C 代替逗号。

【讨论】:

    猜你喜欢
    • 2015-05-16
    • 1970-01-01
    • 2012-08-05
    • 2014-06-12
    • 2020-05-27
    • 2021-04-13
    • 2016-05-12
    • 1970-01-01
    • 2016-06-28
    相关资源
    最近更新 更多