简体   繁体   中英

Managing POST Requests with httpuv package for building a simple API with R

I am trying to build a simple api using httpuv package. The documentation says that one could use the same Rook definition. While using the Rook package one can simple use:

req$POST()

I haven't been able to figure out how to manage simple HTTP POST requests and get their body.

Any hints?

I finally got it working. I found the answer lying somewhere in the opencpu package.

Simply read the POST body stream using:

input <- req[["rook.input"]];

postdata <- input$read_lines();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM