Parses URLs out of the the Link
header as defined by RFC 8288.
Arguments
- resp
A httr2 response object, created by
req_perform()
.- rel
The "link relation type" value for which to retrieve a URL.
Examples
# Simulate response from GitHub code search
resp <- response(headers = paste0("Link: ",
'<https://api.github.com/search/code?q=addClass+user%3Amozilla&page=2>; rel="next",',
'<https://api.github.com/search/code?q=addClass+user%3Amozilla&page=34>; rel="last"'
))
resp_link_url(resp, "next")
#> [1] "https://api.github.com/search/code?q=addClass+user%3Amozilla&page=2"
resp_link_url(resp, "last")
#> [1] "https://api.github.com/search/code?q=addClass+user%3Amozilla&page=34"
resp_link_url(resp, "prev")
#> NULL