【问题标题】:'Incomplete response received from application''从应用程序收到的不完整回复'
【发布时间】:2021-08-21 16:56:29
【问题描述】:

我目前正在 Plesk Web 服务器上运行 API,配置并运行 Node.js。我的 post 请求和 get 请求似乎可以正常工作并完美返回,但是当我尝试发送 put 请求时,我被告知“从应用程序收到不完整的响应”。

在查看了几个线程后,我发现这可能与“secret_key”的问题有关,但这让我感到困惑,为什么这只会发生在 put 请求上,以及如何纠正无法访问控制台的问题。

put请求的代码如下:

app.put('/players', function (req, res) {
   connection.query('UPDATE `players` SET `playerID`=?,`money`=?,`bounty`=?', [req.body.playerID ,req.body.money, req.body.bounty], function (error, results, fields) {
      if (error) throw error;
      res.end(JSON.stringify(results));
    });
});

例如,在发送请求时,我会发送以下正文:

{"playerID":53,"money":2332,"bounty":4}

作为将返回该错误的 JSON。

感谢您的帮助。

【问题讨论】:

    标签: mysql node.js rest put


    【解决方案1】:

    发现问题。在我的 SQL 请求中,我从不指定要更新哪一行。我指定要更新的字段,但从不包含 'WHERE playerID='

    不幸的是,这是一个非常具体的错误,不会使很多人受益。 :(

    【讨论】:

      猜你喜欢
      • 2019-12-04
      • 2021-04-09
      • 2018-12-03
      • 2015-08-04
      • 1970-01-01
      • 2021-12-05
      • 2015-08-22
      • 2015-05-28
      • 1970-01-01
      相关资源
      最近更新 更多