Post 在 R Plumber 中不断给出错误信息

Post in R Plumber keeps giving error message

我正在尝试 post 一些值给管道工 (0.4.6) API,但我不断收到以下错误:

错误

<simpleError in (function (orgName, reportType, teamCode) {    code <- teamCode    org <- orgName})(): argument "teamCode" is missing, with no default>

管道工API路线

#* @apiTitle Set team codes
#* @post /report
function(orgName, reportType, teamCode){
  
  code <- teamCode
  org <- orgName
  
}

Fiddler 显示 POST

期间发送的数据

我根据文档和 SO 问题尝试了其他一些方法,但这些都没有用。所以,我不确定发生了什么以及为什么它不处理请求。我不明白这个错误是什么意思。

我在 express.js 上也遇到过这样的问题。我不知道你是如何发送数据的,因为你没有显示它。但似乎您发送 post 请求的方式可能没有正确格式化数据 - 特别是因为@BrunoTremblay 能够使用 httr 到 post 请求。您的 express.js post 请求至少应包含 headers、url 和表单。

var request = require('request');

request.post({
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    url: 'http://localhost:7667/report',
    form: req.body
  }, (error, response, body) => {
    if (error) {
      console.log(error)
      return
    }

我还没有测试过,但希望这能给你一个想法,看看你的请求是否也以同样的方式配置。