Skip to content

Support parsing RFC-8288 link header #791

@czechboy0

Description

@czechboy0

Motivation

It'd be useful if the OpenAPI runtime supported parsing the "link" header

Steps To Reproduce:

  1. Call an API that returns links via the "link" header

switch try await client.listRepositories(request) {
case .ok(let ok):
let links = okResponse.headers.link
...
}

Results:
We just get back a link of string, which is difficult to work with. In particular when it's used for pagination like in the Github API for example:

Link: https://api.github.com/repositories/1300192/issues?page=4; rel="next"

We need to parse the links to find the one with the "next" relation, then parse its URL to extract the page parameter, so that we can call the API to fetch the next page.

It'd be useful if it at least the links were available in parsed form, so that we only need to deal with the URL itself.

https://datatracker.ietf.org/doc/html/rfc8288
https://docs.github.com/en/rest/using-the-rest-api/using-pagination-in-the-rest-api?apiVersion=2022-11-28#using-link-headers

Proposed solution

See above

Alternatives considered

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions