Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loadtesting with JSON/list content does not work #21

Open
acircleda opened this issue Aug 17, 2024 · 0 comments
Open

loadtesting with JSON/list content does not work #21

acircleda opened this issue Aug 17, 2024 · 0 comments

Comments

@acircleda
Copy link

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) ------^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant