【问题标题】:plumber @post results in "404 - Resource Not Found"管道工@post 导致“404 - 找不到资源”
【发布时间】:2016-12-12 20:09:54
【问题描述】:

我尝试在 page 上复制部分示例。但是,当我尝试http://my-host:8000/input?val=1 时,它给了我错误{"error":["404 - Resource Not Found"]}

我错过了什么吗?

plumb-test.R

mylist <- 15

#* @post /input
function(val, res){
  v <- as.numeric(val)
  if (is.na(v)){
    res$status <- 400
    res$body <- "val parameter must be a number"
    return(res)
  }
  mylist <<- c(mylist,val)

  list(result="success")
}

【问题讨论】:

    标签: r post plumber


    【解决方案1】:

    尝试使用 curl 和 -X POST,如下所示:

    curl -X POST "http://my-host:8000/input?val=1"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多