I am trying to send JSON content to loadtest with my API. While the JSON content itself works (I have other tests running against this JSON), when passed to loadtest, it does not. I keep getting parse errors on the input. Here is a reprex:
Super simple API saved to "multiply_api.R"
library(plumber)
#* Multiply a number by 10
#* @param num:object The number to be multiplied
#* @post /multiply
function(req) {
input <- jsonlite::fromJSON(req$postBody)
input$num * 10
}
You can run this API with
plumber::pr("multiply_api.R") |>
plumber::pr_run(port=80)
Here is the loadtest:
loadtest(url = "http://localhost:80/multiply",
method = "POST",
body = list(num=5),
encode="json",
threads = 8,
loops = 2,
delay_per_request=100)
And here are the errors I see:
<simpleError: parse error: premature EOF
(right here) ------^
I am trying to send JSON content to loadtest with my API. While the JSON content itself works (I have other tests running against this JSON), when passed to
loadtest, it does not. I keep getting parse errors on the input. Here is a reprex:Super simple API saved to "multiply_api.R"
You can run this API with
Here is the loadtest:
And here are the errors I see: