Skip to content

Read links from Link header of a Solid resource - #165

Open
mrkvon wants to merge 2 commits into
o-development:mainfrom
mrkvon:feat/issue-59/link-headers-resource
Open

Read links from Link header of a Solid resource#165
mrkvon wants to merge 2 commits into
o-development:mainfrom
mrkvon:feat/issue-59/link-headers-resource

Conversation

@mrkvon

@mrkvon mrkvon commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Solid Resources now have method async getLinkHeader(ignoreCache?: boolean).

The successful linkHeader result exposes interface of https://www.npmjs.com/package/http-link-header which allows flexible access to the parsed links from the link header.
e.g. linkHeaderResult.linkHeader.get("rel", "acl") By default, the parsed link header is stored and read from cache.

The cache gets cleared when the resource is deleted.

To consider: Clear resource's link header cache also when a resource is updated, or whenever it is fetched with an error?

Update: we always make a fresh HEAD request. No cache involved.

We also expose all other headers in raw form via resource.getHeaders(): Promise<Headers> and resource.getHeader(headerName: string): Promise<string|null>

Closes #59

@mrkvon
mrkvon force-pushed the feat/issue-59/link-headers-resource branch 2 times, most recently from 58d217e to 62d402b Compare July 23, 2026 05:01

@jaxoncreed jaxoncreed left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me:

2 things:

  • Update .js imports to remove .js
  • This should be expanded to handle headers in general, and not cache at all.

Solid Resource has method `async getLinkHeader(ignoreCache?: boolean)`.

The successful linkHeader result exposes interface of
https://www.npmjs.com/package/http-link-header which allows flexible
access to the parsed links from the link header.
e.g. `linkHeaderResult.linkHeader.get("rel", "acl")`
By default, the parsed link header is stored and read from cache.

Closes o-development#59
@mrkvon
mrkvon force-pushed the feat/issue-59/link-headers-resource branch from 62d402b to c1aded8 Compare July 25, 2026 20:31
- Add resource method getHeaders() to get response headers.
- Add resource method getHeader(headerName) to get specific header.
- Remove .js from imports.
- Other fixes and typos.
@mrkvon

mrkvon commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author
  • Update .js imports to remove .js

  • This should be expanded to handle headers in general, and not cache at all.

Added methods resource.getHeaders() and resource.getHeader(headerName: string)

51a2d25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[solid] Accessing links from HTTP response headers of the resource

2 participants