resp_link_url {httr2} | R Documentation |
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)
Arguments
resp |
An HTTP response object, as created by |
rel |
The "link relation type" value for which to retrieve a URL. |
Value
Either a string providing a URL, if the specified rel
exists, or
NULL
if not.
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")
resp_link_url(resp, "last")
resp_link_url(resp, "prev")
[Package httr2 version 1.0.2 Index]