expressjs / expressjs/express

links() function insufficient for attributes other than `rel`

Open
#2,575 3 comments 0 reactions 0 assignees View on GitHub
4.x 5.x enhancement
Dominant language
JavaScript
Stars
69.5k
Forks
25k
Avg merge
4d 20h
Merged PRs (30d)
9

Description

With [v4 `links()` function](http://expressjs.com/4x/api.html#res.links) it is not possible to set the [`type` attribute](http://tools.ietf.org/html/rfc5988#section-5.4), inter alia.

I propose that an interface variant is added where the function takes an array of objects, e.g.:

``` javascript
res.links([
{
href: 'http://api.example.com/users?page=2',
rel: 'next',
title: 'next chapter',
type: 'text/plain;charset=UTF-8'
},
{
href: 'http://api.example.com/users?page=5',
rel: 'last',
title: 'the grand finale',
type: 'video/webm'
}
]);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.