resp_url: Get URL/components from the response

View source: R/resp-url.R

resp_urlR Documentation

Get URL/components from the response

Description

  • resp_url() returns the complete url.

  • resp_url_path() returns the path component.

  • resp_url_query() returns a single query component.

  • resp_url_queries() returns the query component as a named list.

Usage

resp_url(resp)

resp_url_path(resp)

resp_url_query(resp, name, default = NULL)

resp_url_queries(resp)

Arguments

resp

An HTTP response object, as created by req_perform().

name

Query parameter name.

default

Default value to use if query parameter doesn't exist.

Examples

resp <- request(example_url()) |>
  req_url_path("/get?hello=world") |>
  req_perform()

resp |> resp_url()
resp |> resp_url_path()
resp |> resp_url_queries()
resp |> resp_url_query("hello")

httr2 documentation built on Nov. 14, 2023, 5:08 p.m.