Commit e83b884e authored by Ben Boeckel's avatar Ben Boeckel
Browse files

api/paged: support the Links header

GitLab used a non-standard header for keyset pagination. It will be
going away, but not all instances are updated to have the proper `Link`
header.

Fixes: #46
parent 9b5b799c
......@@ -23,6 +23,8 @@
## Fixes
* Added pagination support to `api::projects::labels::Labels`
* Keyset pagination also supports the to-be-removed (14.0) `Links` HTTP
header.
# v0.1301.0
......
......@@ -269,9 +269,12 @@ where
}
fn next_page_from_headers(headers: &HeaderMap) -> Result<Option<Url>, PaginationError> {
headers
.get_all(reqwest::header::LINK)
.iter()
let link_headers = headers.get_all(reqwest::header::LINK).iter();
// GitLab 14.0 will deprecate this header in preference for the W3C spec's `Link` header. Make
// it less preferred to it in anticipation for this change.
let links_headers = headers.get_all("Links").iter();
link_headers
.chain(links_headers)
.map(|link| {
let value = link
.to_str()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment