Skip to content

[Repo Assist] Add Http.ParseLinkHeader utility for RFC 5988 Link headers#1675

Merged
dsyme merged 2 commits intomainfrom
repo-assist/fix-issue-805-http-parse-link-header-d61a12bc73f40e44
Feb 27, 2026
Merged

[Repo Assist] Add Http.ParseLinkHeader utility for RFC 5988 Link headers#1675
dsyme merged 2 commits intomainfrom
repo-assist/fix-issue-805-http-parse-link-header-d61a12bc73f40e44

Conversation

@github-actions
Copy link
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Adds Http.ParseLinkHeader, a small utility that parses an RFC 5988 Link response header into a Map(string, string) from relation type to URL.

What's changed

  • Http.ParseLinkHeader(linkHeader: string) → Map(string, string) — parses a Link header such as:

    (https://api.github.com/repos/.../releases?page=2); rel="next", <...>; rel="last"
    

    into Map [ "next", "(redacted)"; "last", "(redacted)" ]

  • Documentation — added a "Paginated APIs (RFC 5988 Link headers)" section to docs/library/Http.fsx with a complete example showing how to walk through a paginated JSON API using JsonProvider + ParseLinkHeader

  • 4 unit tests covering empty header, single relation, next/last, and first/prev/next/last

Motivation

Many REST APIs (GitHub, GitLab, npm, etc.) use RFC 5988 Link headers for pagination. FSharp.Data already has HttpResponseHeaders.Link as a constant, but no utility to parse the value. This ~15-line addition closes the gap and lets users compose pagination themselves without bringing in additional dependencies.

Closes

Closes #805

Test Status

4 new unit tests pass; 11/11 total ParseLinkHeader/AppendQueryToUrl tests pass (run with dotnet test --filter ParseLinkHeader|AppendQueryToUrl).

Generated by Repo Assist

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@afb00b92a9514fee9a14c583f059a03d05738f70

Adds a new static method Http.ParseLinkHeader that parses the 'Link'
response header (RFC 5988) into a Map<string, string> from relation
type to URL. This is useful for consuming paginated REST APIs such as
GitHub, GitLab, etc. that use Link headers to provide next/prev/last
page URLs.

Also adds documentation in Http.fsx showing a complete pagination
example using JsonProvider and ParseLinkHeader together.

Closes #805

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dsyme dsyme marked this pull request as ready for review February 27, 2026 10:30
@dsyme dsyme merged commit 7c515ca into main Feb 27, 2026
2 checks passed
@dsyme dsyme deleted the repo-assist/fix-issue-805-http-parse-link-header-d61a12bc73f40e44 branch February 27, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pagination in the JSON type provider

1 participant