Wrap the parsed response body in a list(). Unlike resp_body_auto(), this
function prevents individual response bodies from being concatenated when
combining multiple responses, which is useful for raw or otherwise
non-concatenatable types.
Arguments
- resp
(
httr2_response) A singlehttr2::response()object (as returned byhttr2::req_perform()).- resp_body_fn
(
function) A function to extract the body of the response. Default:resp_body_auto().
Value
The parsed response body wrapped in a list(). This is useful for
things like raw vectors that you wish to parse with httr2::resps_data().
Examples
resp <- httr2::response_json(body = list(a = 1, b = "hello"))
resp_body_separate(resp)
#> [[1]]
#> [[1]]$a
#> [1] 1
#>
#> [[1]]$b
#> [1] "hello"
#>
#>