Visitar URL original
Extend res.links() to allow adding multiple links with the same rel · Issue #2729 · expressjs/express · GitHub
Skip to content

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

Closed

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".

Activity

  1. added 4 commits that reference this issue on Feb 13, 2025
    1ca0a0d
    a1ff1b0
    ec23568
    94869c7
  2. added a commit that references this issue on Feb 14, 2025
    caa4f68
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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