req <- request("http://example.com")
# Change url components
req |>
req_url_path_append("a") |>
req_url_path_append("b") |>
req_url_path_append("search.html") |>
req_url_query(q = "the cool ice")
# Change complete url
req |>
req_url("http://google.com")
# Use .multi to control what happens with vector parameters:
req |> req_url_query(id = 100:105, .multi = "comma")
req |> req_url_query(id = 100:105, .multi = "explode")
# If you have query parameters in a list, use !!!
params <- list(a = "1", b = "2")
req |>
req_url_query(!!!params, c = "3")
Run the code above in your browser using DataLab