Skip to content

Extend res.links() to allow adding multiple links with the same rel #2729

Closed
@Myhlamaeus

Description

@Myhlamaeus

Currently, res.links allows to only add a single link per rel per call. One can add multiple link with the same rel through calling res.links multiple times. #2575 would also allow to add multiple links with the same call. Both of these methods are, however, quite cumbersome when one wants to simply add multiple links with the same rel and without optional parameters.

A possible alternative would be to allow the following:

res.links({
  self: '/a',
  item: ['/a/0', '/a/1']
})

Note that this would currently result in Link: </a>; rel="self", </a/0,/a/1>; rel="item", which is incorrect - the path may contain commas, so /a/0,/a/1 is a single path. The expected result would be Link: </a>; rel="self", </a/0>; rel="item", </a/1>; rel="item".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions