Link header
Parse and build the HTTP Link header (RFC 8288 Web Linking) — the standard way to convey relations between resources, most visibly REST pagination (Link: <…?page=2>; rel="next"). A header carries one or more comma-separated links, each an angle-bracketed URI reference followed by ;-separated parameters (rel, title, type, …).
parse returns one object per link with its uri, the (space-split) rel relation types, and the remaining params; serialize is the inverse. The comma split and quoted-parameter unwrapping reuse the framework's RFC 8941 structured-field helpers so a comma inside a quoted title never fake-splits the list.
b.linkHeader.parse(headerValue) #
Parse an HTTP Link header value (RFC 8288) into an array of { uri, rel, params } — one per link. uri is the angle-bracketed target, rel is the array of (space-separated) relation types, and params is the remaining parameters with quoted values unwrapped. A comma inside a quoted parameter value does not split the list. A link without a bracketed URI is refused.
b.linkHeader.parse('; rel="next", ; rel="last"');
// → [ { uri: "https://api/x?page=2", rel: ["next"], params: {} },
// { uri: "https://api/x?page=9", rel: ["last"], params: {} } ]
b.linkHeader.serialize(links) #
Build an HTTP Link header value from an array of { uri, rel, params? } (or a single such object). The URI is angle-bracketed, rel (string or array) is emitted first, and every parameter value is double-quoted (always valid under RFC 8288, and required for space-separated multi-rel and media-type values like text/html). Useful for emitting standard REST pagination links.
b.linkHeader.serialize([
{ uri: "https://api/x?page=2", rel: "next" },
{ uri: "https://api/x?page=9", rel: "last", params: { title: "end" } },
]);
// → '; rel="next", ; rel="last"; title="end"'
Last updated 2026-08-08T16:39:49.652Z by seeder.