Skip to content
  • req_url() replaces the entire url

  • req_url_query() modifies the components of the query

  • req_url_path() modifies the path

  • req_url_path_append() adds to the path


req_url(req, url)

req_url_query(.req, ...)

req_url_path(req, ...)

req_url_path_append(req, ...)


req, .req

A request.


New URL; completely replaces existing.


For req_url_query(): Name-value pairs that provide query parameters. Each value must be either a length-1 atomic vector (which is automatically escaped) or NULL (which is silently dropped). If you want to opt out of escaping, wrap strings in I().

For req_url_path() and req_url_path_append(): A sequence of path components that will be combined with /.


A modified HTTP request.


req <- request("")

# 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")
#> <httr2_request>
#> GET
#> Body: empty

# Change complete url
req %>%
#> <httr2_request>
#> GET
#> Body: empty