You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came upon an issue with responses with multiple link headers in the response. While this is allowed by RFC 8288 (https://www.rfc-editor.org/rfc/rfc8288.html, see examples at bottom of section 3.5), the call to resp_link_url() and the underlying call to resp_header() only returns the value of the first header.
Example:
library(httr2)
# example requestresp<- request("https://geo.api.vlaanderen.be/Gebouwenregister") |>
req_url_path_append("ogc/features/v1/collections/Gebouw/items") |>
req_url_query(limit=50,
crs="http://www.opengis.net/def/crs/EPSG/0/31370",
startIndex=50) |>
req_headers(Accept="application/geo+json") |>
req_perform()
# headers contain multiple links
print(resp_headers(resp))
# resp_link_url() will return NULL for rel "next"
print(resp_link_url(resp, rel="next")
# resp_header("link") returns only the first value
print(resp_header(resp, "link")
I'm not sure what would be the optimal solution for this problem. I think the easiest would be to adapt the function resp_link_url() to use resp_headers(resp, filter='link') and than handle each link header, instead of using resp_header('link').
Kind regards,
Maarten
The text was updated successfully, but these errors were encountered:
maarten-vermeyen
changed the title
resp_link_url() and doesn't handle multiple link headers
resp_link_url() doesn't handle multiple link headers
Nov 22, 2024
Hi everyone,
I came upon an issue with responses with multiple link headers in the response. While this is allowed by RFC 8288 (https://www.rfc-editor.org/rfc/rfc8288.html, see examples at bottom of section 3.5), the call to
resp_link_url()
and the underlying call toresp_header()
only returns the value of the first header.Example:
Output:
I'm not sure what would be the optimal solution for this problem. I think the easiest would be to adapt the function
resp_link_url()
to useresp_headers(resp, filter='link')
and than handle each link header, instead of using resp_header('link').Kind regards,
Maarten
The text was updated successfully, but these errors were encountered: