Package Exports
- http-link-header
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (http-link-header) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
HTTP Link Header
Parse & format HTTP link headers according to RFC 5988
Install via npm
$ npm install --save http-link-header
Status
It can currently parse (almost) everything according to the RFC, with exception of a few cases where control chars show up in attribute values:
- attribute contains semicolon
- attribute contains comma
- multiple links contain mixed comma & semicolon
Usage
var LinkHeader = require( 'http-link-header' )
var link = LinkHeader.parse(
'<example.com>; rel="example"; title="Example Website", ' +
'<example-01.com>; rel="alternate"; title="Alternate Example Domain"'
)
> Link {
refs: [
{ uri: 'example.com', rel: 'example', title: 'Example Website' },
{ uri: 'example-01.com', rel: 'alternate', title: 'Alternate Example Domain' },
]
}
link.rel( 'alternate' )
> { uri: 'example-01.com', rel: 'alternate', title: 'Alternate Example Domain' }
link.has( 'rel', 'alternate' )
> true
link.get( 'title', 'alternate' )
> { uri: 'example-01.com', rel: 'alternate', title: 'Alternate Example Domain' }