Learn R Programming

httr2 (version 1.0.3)

resp_link_url: Parse link URL from a response

Description

Parses URLs out of the the Link header as defined by RFC 8288.

Usage

resp_link_url(resp, rel)

Value

Either a string providing a URL, if the specified rel exists, or NULL if not.

Arguments

resp

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

rel

The "link relation type" value for which to retrieve a URL.

Examples

Run this code
# Simulate response from GitHub code search
resp <- response(headers = paste0("Link: ",
  '; rel="next",',
  '; rel="last"'
))

resp_link_url(resp, "next")
resp_link_url(resp, "last")
resp_link_url(resp, "prev")

Run the code above in your browser using DataLab