Skip to content

Unnecessary warning when POST (JSON) body has multiple lines #270

@jnolis

Description

@jnolis

If the POST JSON body has newlines in it, plumber creates a warning during the request:

Warning in if (stri_startswith_fixed(body, "{")) { :
  the condition has length > 1 and only the first element will be used

Here is a toy example that creates the warning with a multi-line JSON body:

functions.R:

#' @post /test
function(message){
  "it works!"
}

run.R

library(plumber)
r <- plumb("functions.R")
r$run(port=80)

I think this could be fixed by simply changing the body in this line to body[1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: noviceAnyone could helpeffort: low< 1 day of workhelp wantedSolution is well-specified enough that any community member could fixpriority: lowWill be fixed eventuallytype: bugMaintainers have validated that it is a real bug in the project code

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions