Skip to content

curl_translate() should deparse a JSON body #258

@mgirlich

Description

@mgirlich
httr2::curl_translate(r"--{curl http://example.com --data-raw '{"a": 1, "b": "text"}'  -H Content-Type:application/json}--")

generates

request("http://example.com") %>% 
  req_body_raw("{\"a\": 1, \"b\": \"text\"}", "application/json") %>% 
  req_perform()

it would be much nicer to instead generate

request("http://example.com") %>% 
  req_body_json(list(a = 1L, b = "text")) %>%
  req_perform()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions