nealrichardson/httptest2

Requests with multipart body containing character values fail

jmaspons opened this issue · 0 comments

Character values should also be accepted (see the last example in https://httr2.r-lib.org/reference/req_body.html) but they fail in httptest2:

library(httr2)
library(httptest2)

path <- tempfile()
writeLines(letters[1:3], path)

req <- request(example_url()) |>
  req_url_path("/post") |>
  req_body_multipart(file = curl::form_file(path), char = "some text", form = curl::form_data("data"))
# req_dry_run(req)
capture_requests(req_perform(req))
#> Error in x$value: $ operator is invalid for atomic vectors

It works removing the char = "some text" part.